LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-25-2013, 08:53 PM   #1
hhoyt
LQ Newbie
 
Registered: Jun 2010
Posts: 17

Rep: Reputation: 1
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
 
Old 12-25-2013, 09:31 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,928

Rep: Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865Reputation: 1865
Use "mv" with the full filename with back-slashes to escape the blank and (both) parentheses (i.e. don't use the aster).
 
Old 12-25-2013, 09:41 PM   #3
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,410
Blog Entries: 1

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
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.
 
Old 12-25-2013, 09:47 PM   #4
hhoyt
LQ Newbie
 
Registered: Jun 2010
Posts: 17

Original Poster
Rep: Reputation: 1
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
 
Old 12-25-2013, 09:54 PM   #5
hhoyt
LQ Newbie
 
Registered: Jun 2010
Posts: 17

Original Poster
Rep: Reputation: 1
~/Downloadsmv pvrc.org \(\2\)\ pvrc.org
mv: cannot stat `pvrc.org': No such file or directory
 
Old 12-25-2013, 10:11 PM   #6
nd7rmn8
Member
 
Registered: Jan 2013
Distribution: Arch
Posts: 50

Rep: Reputation: 13
you are getting closer, try either of these.
Code:
mv pvrc.org\ \(2\) pvrc.org
mv 'pvrc.org (2)' pvrc.org
 
1 members found this post helpful.
Old 12-26-2013, 09:28 AM   #7
hhoyt
LQ Newbie
 
Registered: Jun 2010
Posts: 17

Original Poster
Rep: Reputation: 1
mv 'pvrc.org (2)' pvrc.org
is a simple solution.

Thanks !

Howie
 
Old 12-26-2013, 05:08 PM   #8
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,410
Blog Entries: 1

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Line Question DrVenom14 Linux - Newbie 6 03-09-2013 12:09 PM
Command line question ghostrider.002 Red Hat 1 05-19-2007 02:18 AM
Command line question shadoweyez Linux - Software 2 11-18-2005 07:28 PM
Command line question satimis Linux - General 14 06-20-2005 10:46 PM
command line question phonecian Linux - Software 2 10-09-2004 09:36 AM


All times are GMT -5. The time now is 10:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration