LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   script to rename muliple files (https://www.linuxquestions.org/questions/programming-9/script-to-rename-muliple-files-418220/)

cranium2004 02-21-2006 10:24 PM

script to rename muliple files
 
helloo,
I downloaded some files using wget and i got thier names starting with "index.php?dir=" how can i remove them in one single script?

gilead 02-21-2006 10:29 PM

There's the rename command with a syntax like rename from to file. An example from the man page is rename .htm .html *.htm. You'd probably have something like:
Code:

rename 'index.php?dir=' '' *

cranium2004 02-21-2006 10:46 PM

hi,
no it not worked. see what i want is
if filename starts with index.php?dir=abcd?=&pqrxbook1.pdf then i want that file to be renames to book1.pdf only

gilead 02-21-2006 10:59 PM

Did you try it this way?
Code:

$ ls -l
total 0
-rw-r--r--  1 steve steve 0 2006-02-22 14:54 index.php?dir=abcd?=&pqrxbook1.pdf
$ rename 'index.php?dir=abcd?=&pqrx' '' *
$ ls -l
total 0
-rw-r--r--  1 steve steve 0 2006-02-22 14:54 book1.pdf

Can the file names vary with different extensions or do the parameter values change?


All times are GMT -5. The time now is 06:49 AM.