scripting question
Hello,
I have a question, but do not know how to set it up, so it can be solved. Lets say you have files, in a dir, named 0020.mpeg, 0030.mpeg, 0040.mpeg, ex: /home/lazy/movies/1/0020.mpeg /home/lazy/movies/1/0030.mpeg However you have about 500 dir. like this. /home/lazy/movies/2/0020.mpeg /home/lazy/movies/2/0030.mpeg, How would you be able to get all them, in order (starting from dir 1 to 500), and move them in one dir, and rename them in order. So 0020.mpeg becomes 1.mpeg and so on. Any Insight is appreciated, not looking for a complete answer just any insight on how I would do this. Thanks Lazyuser |
i see 2 for loops. here's a pseudocode i can think of:
Code:
NEWDIR="..." edit: actually, i think this won't work quite the way you want. i think you want the subdirs processed in order like this: movies/1 movies/2 ... movies/9 movies/10 ... but i believe my pseudocode will do it like this: movies/1 movies/10 movies/11 movies/12 ... movies/19 movies/100 movies/101 ... movies/2 movies/20 ... |
You could probably just use a loop:
Code:
#!/bin/bash |
I just happen to have something laying around which may get you started. You could experiment with changing ( ls $dir ) to ( ls -R $dir ) ....
You chomd +x test then run the script like this: ./test /home/dir Code:
#!/bin/sh |
Hello,
You guys rule. I used david_ross example, and it worked. Then I issued the comand, find /home/lazyuser/movies/ -name "*.mpeg" -exec mv {} '/home/lazyuser/movies' \; to move all the files into a dir. One more question, if anybody can help. I want to combine all the files into one file. I know I can use cat, but everytime I try it it dosen't put the files in order. When I go ls *.* | sort -n, it puts them in order the way I want. How do I get that order into cat. Or is there some software in linux, where I can combine .mpeg files. Again any help would be appericate. Thanks for the help already. lazyuser |
Hello,
Well I used TMPGEnc in windows, and it worked great. I was wondering if there is any util like this in linux. lazyuser |
All times are GMT -5. The time now is 10:45 PM. |