2009-04-28, 16:29
Ok, i have been tyrying for a few dyas to get a bash script to rename all my fiels and move them. I have a very basic script that i dont even know how i got to work in the first place, but it does something to my files and its a start. What I want it to do is go through every folder under my Movies directory and rename my files to include tags for sddvd and whatever else would populate the media flags from just the filename. So here is what I have, again its not close to what I want but its what ive got from these confusing ass bash books.
#!/bin/bash
files=$ (ls -l | grep .m4v)
for x in $files
do
mv $x sddvd.$x
done
so this sort of works but it adds the sddvd tag infront of the file name(sddvd.havoc.m4v) needing it to look like(havoc.sddvd.m4v)
so when this was working correctly it would be fine for folder level, but i would also like to run it on my library.
So any help would be appreciated. im not looking for someone to do it for me and then im done with it. i would like to learn more about bash and would love to understand what commands do and and how they work. Im rambling so.......
#!/bin/bash
files=$ (ls -l | grep .m4v)
for x in $files
do
mv $x sddvd.$x
done
so this sort of works but it adds the sddvd tag infront of the file name(sddvd.havoc.m4v) needing it to look like(havoc.sddvd.m4v)
so when this was working correctly it would be fine for folder level, but i would also like to run it on my library.
So any help would be appreciated. im not looking for someone to do it for me and then im done with it. i would like to learn more about bash and would love to understand what commands do and and how they work. Im rambling so.......