By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,567 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,567 IT Pros & Developers. It's quick & easy.

Automatically rename text files

P: n/a
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
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Take a look at the DirectoryInfo and FileInfo classes.

"Shaker" <Sh****@discussions.microsoft.com> wrote in message
news:B3**********************************@microsof t.com...
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

Nov 16 '05 #2

P: n/a
Shaker wrote:
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.
Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.