Questions tagged [getfiles]
266 questions
4
votes
1 answer
GetFiles() not returning first file name in directory C#
I am writing a test script to use in a larger script. I need to get the very first file in the Music Directory so I can automate opening wmplayer and playing the first song.
If I hard code the file name and start the Process, it works. However, if…

DevOpsSauce
- 1,319
- 1
- 20
- 52
4
votes
2 answers
Ruby - Get the second most recent file from a directory?
I have this piece of script to acquire the most recent file in a directory
dir=Dir.glob("./logs/*").max_by {|f| File.mtime(f)}
I would like to also acquire the second most recent file from the directory. What could I write to achieve this?

Whelandrew
- 195
- 10
4
votes
2 answers
How to get files from exact subdirectories
I've managed to get files out of "root" folder subdirectories, but I also get files from these subdirectories directories2, which I don't want to.
Example: RootDirectory>Subdirectories (wanted files)>directories2 (unwanted files)
I've used this…

anzes
- 57
- 1
- 1
- 7
3
votes
3 answers
find most recent file in directory
I'm trying to load the most recent file from a directory, but my following code doesn't work. Am i getting something obvious terribly wrong?!
Dim myFile = Directory.GetFiles("C:\Users\Joe\Desktop\XML Logs").OrderByDescending(Function(f)…

A Smith
- 251
- 2
- 4
- 10
3
votes
1 answer
return an array from glob node js
The issue
I'm using the answer here Get all files recursively in directories NodejS
however, when I assign it to a constant I'm trying to return the directories so I can have them available in an array, I have looked through globs documentation for…

hjm
- 1,733
- 2
- 16
- 27
3
votes
2 answers
Python Paramiko SFTP get file along with file timestamp/stat
# create SSHClient instance
ssh = paramiko.SSHClient()
list = []
# AutoAddPolicy automatically adding the hostname and new host key
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.load_system_host_keys()
ssh.connect(hostname, port,…

Jack Lim
- 195
- 2
- 5
- 16
3
votes
1 answer
ColdFusion cfftp getfile exceeds timeout
I am running CF 11. I have a file on a SFTP server that I want to get. This is a zip file about 60MB in size.
I can get the SFTP connection. However, when I use action="getfile" to get the file to my local. The error that I am getting is,…

Monte Chan
- 1,193
- 4
- 20
- 42
3
votes
3 answers
how to avoid unauthorized access exception?
The following is my code.
//string[] directories;
List dirs = new List(Directory.EnumerateDirectories("C:\\Users\\Josh"));
//string[] Files;
//directories = Directory.GetDirectories(@"C:\Users\Josh\", "*",…

Josh Banks
- 31
- 2
- 9
3
votes
2 answers
Delete all in folder except the filename in list
I have a folder, and a list (which contain file names).
I want the program delete files except the file which are listed.
C#
I hope it is possible.
Now used code:
It delete only ONE file.
string folder = Directory.GetCurrentDirectory();
…

GaboO
- 51
- 1
- 8
3
votes
3 answers
Path.GetFilename - Attempting to get the filenames from a directory
I've been able to get this code to work:
string[] path = Directory.GetFiles(@"c:\Users\james.krueger\Desktop\Test Folder\");
The problem is this displays the entire path.
This next block of code seems to be what I want. However, it prompts me with…

Jimmy K
- 89
- 1
- 9
3
votes
2 answers
Get files of certain extension c#
I wish to get a list of all the files of a certain extension (recursive), but only the files ending with that extension.
For example, I wish to get all the files with the ".exe" extension, If I have the following files:
file1.exe , file2.txt.exe ,…

Idanis
- 1,918
- 6
- 38
- 69
3
votes
2 answers
how to generate thumbnail for all video file using ffmpeg?
I successfully generated a thumbnail for a video file using ffmpeg and now I want to create a thumbnail for each video in directory. How can I read all video files in the directory and generate thumbnail for each video using ffmpeg?

Lynx
- 259
- 1
- 9
- 26
3
votes
3 answers
Filter P4 .Net file list
I have a program that populates a combo box with details of files contained in a selected directory in a perforce depot.
The relevant piece of code is this:
PerforcePath dir = _ctlProductSelect.SelectedItem as…

Mark R
- 123
- 1
- 7
2
votes
2 answers
C#: Access to path <'filepath'> is denied
Possible Duplicate:
Why am I getting an access denied error for the Documents and Settings folder?
I have a program that will read all .exe files from a user specified folder and its sub-directories. While testing I tried to scan using C:\ as…
user1192312
2
votes
1 answer
UnauthorizedAccessException while getting files
I am creating an application which finds duplication in files. When I search files like:
try
{
string[] allFiles = Directory.GetFiles(
directoryPath, "*.*", SearchOption.AllDirectories
);
for (int i = 0; i < allFiles.Length;…

Muhammad Ali Dildar
- 1,467
- 6
- 24
- 35