95 questions
0
votes
1
answer
110
views
how to rename file after export from filename sequential based on expression datatable in VB.NET
I'm Trying to to rename file image after export with datatable in VB.NET
I use library control LabelControl for .NET from BaiqiSoft
I have also asked Baiqisoft support and then he replied "this ...
3
votes
1
answer
68
views
How to interrupt [IO.Directory]::GetFiles() in powershell?
I'm using the following to quickly find specific files from powershell CLI.
[IO.Directory]::GetFiles($searchDir, $searchFile, [IO.EnumerationOptions] @{AttributesToSkip='Hidden,Device,Temporary,...
1
vote
2
answers
396
views
How to hidde a directory or a folder with the Set-itemProperty command?
$Path|Set-ItemProperty -name Hidden -Value $true
$Path|Set-ItemProperty -name isHidden -Value $true
Set-ItemProperty -path $Path -name isHidden -Value $true
#Error: Set-ItemProperty: The property ...
0
votes
1
answer
285
views
How to skip files while deleting
I'm building an console application to delete files and folders from appdata/local/temp. I have referred multiple sites & pages in SO. But unfortunately couldn't get much.
What I have done so far:
...
-1
votes
1
answer
152
views
Is there a specific scenario where Directory.EnumerateFiles would return 0 results from a directory with hundreds of files?
I'm writing code in a .NET Framework 4.7.2 app and for some reason it's not returning any files when I run this snippet on a populated directory:
var files = Directory.EnumerateFiles(appDirectory, $&...
0
votes
0
answers
73
views
Cannot create directory on local network
string serverPath = GetServerDirectory(serverDirectory);
string fullPath = @Path.Combine(serverPath, "P00125");
if (!Directory.Exists(fullPath))
Directory.CreateDirectory(fullPath);
...
0
votes
1
answer
527
views
Is there an efficient way to Generate Folders using compiled-time source generator in c#?
Compiled-time source generator for folders:
Is there an efficient way to make the Source Generators generate folders at compile time, not just files?
Note: I know that I can use System.IO, but I do ...
0
votes
2
answers
413
views
C# Directory.GetDirectories() return inexisting directory
I want to use Directory.GetDirectories(path) and then working with sub-directories but, when I start running my app, VS return me System.UnauthorizedAccessException. I can understand I fix this, no ...
1
vote
1
answer
90
views
Determine C# code class file's parent directory path at design-time
Here is info about our technical development environment :
• .NET Core 3.1
• PostgreSQL 14.2, compiled by Visual C++ build 1914, 64-bit
• EntityFramework.Functions Version=1.5.0
• Microsoft....
1
vote
0
answers
132
views
Why do I get this IOException, when I'm not even trying to open the file?
I tried this code:
var HighestFolder = Directory.GetDirectories("U:/New/Items", "*", SearchOption.AllDirectories)
.Select(x => x.Replace('\\','/'))
...
-1
votes
1
answer
1k
views
Iterate through a directory to get subfolders and certain files
I am working on a program that will move files to a database, text files to be exact. The user will have a starting directory and inside will multiple sub folders and files and so on. I want to go ...
0
votes
0
answers
112
views
Previously using System.IO to find and launch shortcut. This has stopped working
INFORMATION: I created a WPF application (.net 3.1) for some of our business locations to launch the ERP system we use as well as other tools on a kiosk computer. The ERP system runs through Microsoft ...
0
votes
1
answer
1k
views
How to get DirectoryInfo for a Onedrive folder with VB.net
I have some code that uses System.IO to find files with a given extension. This works fine with regular folders but fails when the files are in Onedrive's local cache.
My assumption is that the ...
-2
votes
1
answer
101
views
Creating Subdirectory function in C#
I am currently attempting to create a function code that creates a subdirectory inside a user-specific path by having the user input the Directory path and then in main use the Directory....
-2
votes
1
answer
59
views
TextWriter not working because its being used by another process. Network 5.0
I am trying to create a console app on network version 5.0 using visual studio. The purpose is to read all the PNG files in a directory, and make a JSON file with the code:
{
"format_version&...
2
votes
3
answers
952
views
System.IO.Directory.CreateDirectory - weirdest exception ever
so, I'm trying to create a following directory:
d:\temp\ak\ty\nul
Path is constructed in the loop, starting from: d:\temp and so on, creating non-existent directories along the way, so it first ...
2
votes
1
answer
627
views
Deleting files after copying kills application
I found a very weird bug when using FileInfo.Delete() or Directory.Delete(path, true) after copying a folder.
Problem:
Copy a folder containing many files and a few subfolders recursively
Try to ...
-1
votes
1
answer
325
views
How do I move all the file paths in an array to one directory
This is what I have tried
string[] filestomove = new string[] {"text.txt", "never.json", "gonna.dll", "giveyou.exe", "up.png"};
string[] dirstomove = ...
0
votes
1
answer
188
views
Portable USB device path obtained with shell32 - invalid characters in path
I'm looking for a way to access files on a smartphone connected through USB cable using standard System.IO stuff like Directory and StreamReader.
I have obtained a pretty wicked-looking path to my USB ...
1
vote
0
answers
89
views
Problem Referencing a File from a Project in another Project - ASP.NET Core 3.1
I have 3 projects in a solution, one is a ConsoleApp, the other two are a MyLibrary class library with one class, and a xUnit test project called Tests
I have also created a Configuration file in the ...
0
votes
1
answer
3k
views
Get to a Folder in the Root of my Project - ASP.NET Core 3.1
I have a root folder called TestLogging that contains a solution. I have a console app, which has its own directory, and a test project which also has its own directory.
In Windows explorer I have ...
0
votes
0
answers
653
views
DirectoryInfo.EnumerateFiles() result is empty on Ubuntu
I am looking at System.IO and wrote a small method to count the number of files in a directory. The problem I have is that when I debug this piece of code in windows, I can enumerate over the ...
0
votes
1
answer
224
views
I am trying to populate a list with properties and strings
I am trying to populate a list with property names and values, here is my code so far...
public class DirPropeties {
public string Name { get; set; }
public string Path { get; set; }...
0
votes
1
answer
233
views
.NET Directory.Move() fails for One Drive folders
For the call:
// Directory.Exists(path) returns true
// path = "C:\\Users\\david\\OneDrive - Windward Studios\\Documents\\AutoTag\\templates"
Directory.CreateDirectory(backupFolder);
Directory.Move(...
4
votes
2
answers
4k
views
C# - Check if can access / read folder
Before closing my question, please see what I checked and doesn't work at the end of this question
Question
I've been trying all sorts of SO answers and all of them brings me a an exception, besides ...
0
votes
0
answers
702
views
System.IO.Directory.CreateDirectory(folderPath) does not create a folder
I would like to ask if there is something wrong with this code? Because it does not create a folder if the folder does not exist.
Dim folderPath As String = Server.MapPath("~/Reading/")
If ...
1
vote
2
answers
3k
views
Create a folder within a network drive with System.IO.Directory.CreateDirectory [duplicate]
On my local computer I created the network drive D:/ that points to \\MyComputerName\D.
On my local disk C:/ I created a folder with the name D and configured a network share with permission to ...
0
votes
1
answer
340
views
File could not be found using long file Paths
I'm trying to remove the lfs tracking tag from git before I process some files only some of the files when used in our companies jenkins server contain file paths that are 260+ characters. Due to this ...
1
vote
1
answer
199
views
How to create every non - existing folder in a path? [duplicate]
So I have this code in which I create a file:
string FilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "JMange") + @"\" + Project_Name + ".bin";
try
{
...
-1
votes
1
answer
125
views
Merge from A to B directory updating b directory using system.IO c# [closed]
I would like to compare two equal directories A and B with subdirectories. If I change, delete, or include directories or files in A, I need to reflect on B. Is there is any C # routine that does ...
0
votes
1
answer
90
views
System.IO - Use Directory/LINQ to Replace Some Files in a List with Others
I get a list of files using the System.IO Directory thusly:
var srcFiles = Directory.GetFiles(remotePath);
I also have a comma separated list of strings, each of which I want to check for NON-...
1
vote
3
answers
496
views
Creating (N) directories in a specific path in a loop stopping abruptly
I am attempting to create 10,000 folders in a specific directory.
I have an algorithm for creating a random names for each folder.
The issue I am having is when I run this code, It stops with ...
0
votes
2
answers
812
views
Check if a directory exists using the first 6 (or any) amount of characters
First post, zero programming history but learning on my own with google and Udemy classes.
I wrote a program that will create a bunch of project directories on our server. I need to check the first ...
0
votes
2
answers
1k
views
c# : find file with variable part in its name
I have a folder location corresponding to the variable "path".
In this folder, I have a lot of files, but only one called "common.build.9897ytyt4541". What I want to do is to read the content of this ...
0
votes
0
answers
303
views
Read and list large number of files from multiple folders in c#
I want to read large number of files which spans across multiple folders in a network drive.
I have approximately 20 folders, each folder has 50 sub folders and each sub folder has approximately 400 ...
0
votes
1
answer
913
views
Visual Basic: Reading Filenames from a Directory [closed]
I'm trying to write a simple VB program to read the file names in a given directory. This is what I've written:
Imports System
Imports System.IO
Imports System.Text
Module Program
Sub Main(args As ...
1
vote
2
answers
2k
views
System.IO.Directory.Exists does not work as expected
When string "D:\test\..." is passed to System.IO.Directory.Exists method, it returns True on my machine. I have checked the following code;
public static void Main(string[] args)
{
if (Directory....
0
votes
1
answer
275
views
Does LiteDB support long file names (>=260 char) in the connection string
Im using litedb as a file index, whereby I recreate the directory structure of a file share and drop a litedb.db file into each directory in my hierarchy. The problem I'm encountering seems to be ...
1
vote
1
answer
315
views
Uwp Cannot List or access .lnk or url files
Before I get into further details I wanted to point out that uwp can now know have system wide file access so this issue is not exactly related to that.
With that out of the way, the issue is rather ...
0
votes
3
answers
106
views
Should I dispose copies of StreamReaders/Writers
So I have a class that has a StreamReader as a variable. The StreamReader is set through the constructor. When I use this class, I make a StreamReader outside of the class and pass it through. I then ...
0
votes
0
answers
26
views
How do I access files in main project directory when operating from Unit Test?
I'm creating a XAML application that can accept, as one input a path to a singular Excel file, and as a second input a path to directory holding multiple Excel files. Once these are specified, the ...
0
votes
1
answer
395
views
Loading files from directory and add to combo box
I'm currently trying to add whatever files that exist in the directory into a combo box.
Dim dir = "C:\Users\jason\Desktop\SystemFiles"
For Each file As String In System.IO.Directory.GetFiles(dir)
...
0
votes
0
answers
652
views
Directory.GetDirectories on %USERPROFILE%\My Documents
I'm creating a UserControl for my program which will mimic the OpenFileDialog.
When I navigate to a Directory I am using
System.IO.Directory.GetDirectories(Path)
and
System.IO.Directory.GetFiles(...
0
votes
2
answers
363
views
c# System.IO how do i find all the subfolders given a certain folder?
This is what I've done so far:
class Program
{
static void Main(string[] args)
{
DirectoryInfo startDirectory = new DirectoryInfo(@"C:\Users\Angelo\Desktop\ExerciseTest");
...
1
vote
2
answers
7k
views
System.IO.Directory.Delete Method just sends files to Recycling Bin. Any way to permanently delete?
In .NET, I'm running the code Directory.Delete(tempdir, true); to permanently delete a directory and all contained files. This delete method only sends the files to recycling bin however, instead of ...
0
votes
2
answers
3k
views
Value of type 'DirectoryInfo' cannot be converted to 'String'
I am trying to start a .exe file in a parent folder to which my .exe file is in.
Unfortunately when doing:
dir = Directory.GetParent(Directory.GetCurrentDirectory))
The program gives me an error:
...
0
votes
0
answers
539
views
Best way to determine root directory of project - even if in a web project
I have a constructor of a class which needs to look in the root directory for a settings file. This is working fine for most project types, I grab the directory like this:
new FileInfo(...
1
vote
2
answers
92
views
How do I fix this small (and probably simple) DirectoryInfo Syntax error?
Pretty straight forward. Press a button, select a path from dialogbox, searches path's subdirectories, and shows them in messagebox. But have ran into a couple problems.
private void ...
2
votes
2
answers
1k
views
Directory.GetFiles returns unexpected results with SearchPattern
I'm working on a batch program that process a big amount of files (more than 50 000 files) and I'm facing weird behavior with the Directory.GetFiles method.
In the process I move files that matches ...
0
votes
1
answer
632
views
Linq Not Working on a List of Strings
I am trying to get list of strings containing file paths from a directory. User will be specifying file extensions in comma separated format such as "gif, jpg".
This is my code.
private static List&...