Results 1 to 3 of 3
After I upgraded Debian to the latest stable the ls command changed and it broke a script I used to sort logs for my game servers. The result is that, ...
- 05-19-2007 #1Just Joined!
- Join Date
- Oct 2006
- Posts
- 42
Moving Files in Multiple Directories to a Single Directory
After I upgraded Debian to the latest stable the ls command changed and it broke a script I used to sort logs for my game servers. The result is that, while the logs were supposed to be sorted into a few folders by year, they are now sorted into dozens of folders by time. Is there a way I can move files in multiple folders to a single folder using a script?
All the folders are located in the same directory. The script would have to iterate through the old folders and move the files in them to the new folder.
- 05-19-2007 #2Iterates through folders, checks if it's a regular file, if it is then move it.Code:
for i in `find /path/to/old/dir/`; do if (test -f $i); then mv $i /path/to/new/dir/; fi; done
- 05-19-2007 #3Just Joined!
- Join Date
- Oct 2006
- Posts
- 42
Very much appreciated, thank you!


Reply With Quote