How I copy files with same name but in different case in same directory in linux ?
How I copy files with same name but in different case in same directory in linux ?
ex: mpcc & mpCC |
Hi,
welcome to LQ. Quote:
Evo2. |
Hi Virendra,
This solution was posted to you on another forum. ************************** Lets understand the problem. (1) Files are too many to locate and copy one by one. (2) You don't know whether the files will have names in uppercase, lowercase or mixed. Well, the "find" command has an option to find files names with case insensitive. So instead of option "-name" , you have use -iname. Find also has an option called -exec that acts on each selected file. So. find . (or whichever directory) -iname "criterion" -exec command '{}' \; See http://linux.die.net/man/1/find OK ************************** Did you try it? Whats the result? OK |
You should also be able to use simple globbing patterns in many cases, particularly in conjunction with a for loop, although it's also possible to use them directly in commands. Just remember that the string will expand into the full list of matched files before the command is executed.
In bash you can use the nocaseglob shell option to make the globbing matches case insensitive. But even without it it's usually relatively easy to create patterns that match all the files you want. Code:
mv mp* targetdir #move all files that start with lowercase "mp" |
All times are GMT -5. The time now is 06:56 PM. |