Command line question
My apologies on the title, not sure how to phrase, which is probably why I cannot find with Google.
I prefer to run from the cmd line but have a problem on download of a file that exists already. It gets turned into file.ext(1) or suffixed to number of copies- which is my problem, I do not understand how to handle these suffixed files ??? How do I manipulate from the command line ??? Driving me nuts. Mv seems to complain about directory and I think I read that command line 'rename' is really a utility. Certainly file manager has no trouble changing something like file.ext(2) into file.ext but then cmd line d/n recognize file.ext Peppermint 3 kernel 3.12.6 ==========>>> ~/Downloadsls pvrc.org* pvrc.org (2) pvrc.org-Dec-2013.gz ~/Downloadsmv pvrc.org* pvrc.org mv: target `pvrc.org' is not a directory ~/Downloadsmv pvrc.org* ./pvrc.org mv: target `./pvrc.org' is not a directory ~/Downloadsrename pvrc.org* pvrc.org Bareword "pvrc" not allowed while "strict subs" in use at (eval 1) line 1. I am sure there is a good writeup on my problem, but I am missing how to search on it. Thanks, Howie |
Use "mv" with the full filename with back-slashes to escape the blank and (both) parentheses (i.e. don't use the aster).
|
Depending on the distro, mv may not overwrite "existing" files with a matching destination name. Rename is mildly more useful when names contain characters not on a qwerty keyboard. But they basically do the same task. You could cp (copy) and cmp (compare) and rm (delete) the old name and location. Depending on how paranoid you are with your data. The mv option trumps cp in many cases because it preserves the original date/time stamp of the file.
The behavior you describe seems to be the default behavior of web browsers. You could just copy the link and wget the file. Using wget -c lets you continue if wasn't fully downloaded (must be an option serverside / not local). Or wget -i to get from a list of links in a file that follows -i. But in general web browsers do the download of already downloaded stuff and add a postfix on the filename. Even though the same file without the postfix already exists and matches it byte for byte. |
I must be doing it wrong:
~/Downloadsmv pvrc.org\(\2\)\ pvrc.org mv: missing destination file operand after `pvrc.org(2) pvrc.org' ~/Downloadsmv -f pvrc.org\(\2\)\ pvrc.org mv: missing destination file operand after `pvrc.org(2) pvrc.org' Tks, Howie |
~/Downloadsmv pvrc.org \(\2\)\ pvrc.org
mv: cannot stat `pvrc.org': No such file or directory |
you are getting closer, try either of these.
Code:
mv pvrc.org\ \(2\) pvrc.org |
mv 'pvrc.org (2)' pvrc.org
is a simple solution. Thanks ! Howie |
mv pvrc.org\(\2\)\ pvrc.org
The trailing \ on the originating filename is probably what gotcha on your previous attempts. It would escape the space between input and output names and make it all one filename, which it can't find. And of course nothing to move it to since the concatenated input omits the output parameter. If you need a gui option, nautilus (or whatever it goes by these days) lets you do the traditional click wait click to rename a file. Or right mouse -> rename. When all else fails, like unicode / cyrillic characters or filenames with tab characters in them. Which can be annoying to deal with on some [x]terms. |
All times are GMT -5. The time now is 06:24 AM. |