For example, if your batch file was named cleancsv.bat you would use the command. where 1 will be the name of the input csv file containing blank lines and 2 will be a new csv file created without blank lines. Look at the file again, and when you are positive that it's what you want, execute it with sh /tmp/bulk-rename. Create a batch file and use the command. I guess I had to add a character to JDobbsy1987's -11 in order to account for the quotation mark I'd added, though I'm not sure why that doesn't let the space cause problems again. That file now contains a lot of lines like mv -n "foo" "bar" Edit: a little research tells me that the 0,-12 bit is a modifier that strips the last n characters (in this case, n12) from a string. mv -n prevents overwriting an existing file. The sed part adds a mv -n to the start of each of those lines. What that paste command does is it takes one line from /tmp/old.txt and one line from /tmp/new.txt and puts them together on one single line with a blank between them. Under 'Replace with' enter the character you want to replace '<' with or leave blank to remove it. Then put the files together with the paste command and change each line to a mv command: paste /tmp/old.txt /tmp/new.txt | sed -e 's/^/mv -n /' >/tmp/bulk-rename Drag all of the folder you want to rename into the panel where it says 'Drag Files and Folders Here'. In any case, have a good hard look at /tmp/new.txt to see if it's really what you want the new names to look like.Ĭheck for duplicate names! ( sort /tmp/new.txt | uniq -r) Make sure there are no duplicates and if there are, edit that line manually to get a unique name. Important: do not change the order in that file, and do not delete or add any line! It only modifies files/folders names: Changing extension. This program can rename large amounts of files and folders in a few clicks. Then replace unwanted characters in /tmp/new.txt, either manually with an editor or with sed -i -e (or perl -p -i -e if you prefer that) or tr or tr -d. Ant Renamer is a free program that renames lots of files and folders by using specified settings. it will give you "foo*bar" or "foo | bar". Ls -Q will add double quotes around each name, i.e. They have been a big help to me.In general, mmv is great at mass-renaming tasks.īut in this particular case, I'd go a completely different route: Generate a shell script with a couple of shell commands, have a close look at it if it's really what I want, and then execute it. There is also a great Name Mangler Google Group where you can get your questions answered and some very advanced features and methods get discussed. All of that plus being able to use Regex to build very complicated renames. Once of the many things that makes using a tool like Name Mangler valuable is that you can undo your changes, view a history of your changes, and create a "droplet" that make running the name change on other files really convenient.
0 Comments
Leave a Reply. |