Automatically rename text files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I would like to write a program that would automatically take out the spaces in directory names and file names . I would like this because my web server does not allow spaces in names. I figure if I could figure out how to automatically know how many files are in a path, then loop through them, it could be done. Trouble is, I do not know the commands to find out how many files there are. If anyone knows or has suggestions, please let me know.

Thanks
 
Take a look at the DirectoryInfo and FileInfo classes.

Shaker said:
Hello, I would like to write a program that would automatically take out
the spaces in directory names and file names . I would like this because my
web server does not allow spaces in names. I figure if I could figure out
how to automatically know how many files are in a path, then loop through
them, it could be done. Trouble is, I do not know the commands to find out
how many files there are. If anyone knows or has suggestions, please let me
know.
 
Shaker said:
Hello, I would like to write a program that would automatically take out
the spaces in directory names and file names . I would like this because
my web server does not allow spaces in names. I figure if I could figure
out how to automatically know how many files are in a path, then loop
through them, it could be done. Trouble is, I do not know the commands to
find out how many files there are. If anyone knows or has suggestions,
please let me know.

Thanks

You can call the file functions recursively to traverse subdirectories.

Then use a Replace to get rid of the spaces and a .Rename to change the
files.
 
Back
Top