Hello
I am currently using the following to get a list of files in a folder to use in my script:
GetFileList>c:\Temp\*.*,files
Separate>files,;,file_names
ArraySort>file_names
This works well in giving me the full path to the file. However I want to use a variable to store just the filename (without the path),
Could anyone help with this.
Kind regards
Trevor
How to find the name of a file in a folder
Moderators: Dorian (MJT support), JRL
-
- Junior Coder
- Posts: 25
- Joined: Sun Dec 15, 2013 9:27 pm
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: How to find the name of a file in a folder
Hello Everyone,
This seems to work for what I need but only on a single file.
I need to extract the file names to rows in Excel. Is it possible to do this without looping extract file name?
This seems to work for what I need but only on a single file.
I need to extract the file names to rows in Excel. Is it possible to do this without looping extract file name?
- Dorian (MJT support)
- Automation Wizard
- Posts: 1380
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: How to find the name of a file in a folder
I hope I'm understanding correctly, but if you're using GetFileList and then looping through the results extracting the file names, ExtractFileName would need to be inside the loop :
Then of course the code that writes to Excel would also be in that loop.
Code: Select all
Let>GFL_SORTTYPE=3
GetFileList>d:\compiled\*.*,files
Separate>files,;,file_names
Let>k=0
Repeat>k
Let>k=k+1
ExtractFileName>file_names_%k%,ThisFN
mdl>ThisFN
Until>k,file_names_count
Yes, we have a Custom Scripting Service. Message me or go here
Re: How to find the name of a file in a folder
Thanks Dorian!
I was hoping to avoid doing it with a loop but I guess it is the only option.
Thank you as always!
I was hoping to avoid doing it with a loop but I guess it is the only option.
Thank you as always!