LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-04-2011, 02:51 PM   #1
Arkam
LQ Newbie
 
Registered: Dec 2011
Posts: 2

Rep: Reputation: Disabled
Unhappy Multiple Renaming of Files using Curl Command


I have multiple files in a folder. My requirement is to transmit them all in one go and then rename on ftp server. I cant rename before tranmitting. Server accepts only in .lnk format and then we rename it to .dat format.

When i try to upload a single file it works fine like

curl -T file1 --ftpaddress --user username: password

When i try to upload and rename a single file it works fine

curl -T file1 --ftpaddress --user username: password -Q "-RNFR file1" -Q "-RNTO -newfilename"

When i try to do bulk upload it works fine like this

curl -T "{file1,file2}" --ftpaddress --user username: password

But I am unable to rename multiple files (Even single file) when i try to rename them. Ma command fails with message that Quoted string not accepted

curl -T "{file1,file2}" --ftpaddress --user username: password -Q "-RNFR file1" -Q "-RNTO -newfilename" (fails: file do get transmiited but for rename it says quoted string not accepted)

curl -T "{file1,file2}" --ftpaddress --user username: password -Q "-RNFR file1" -Q "-RNTO -newfilename" -Q "-RNFR file2" -Q "-RNTO -newfilename2" (fails: file do get transmiited but for rename it says quoted string not accepted)

The curl man page says i can give series of command using -Q i am sure it does mutliplel renaming of files when i transfer multiple files. I am sure I am making a syntax mistake. If some body can help i will really appreciate. Many thanks

Regards
ARKAM
 
Old 12-04-2011, 02:58 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
You don't need to use "-Q" multiple times; You just use -Q once, then have the file names in series, as such:
Code:
-Q 'rename /path/to/file1 /path/to/file2'
See this thread for more detail about it - http://curl.haxx.se/mail/archive-2011-01/0015.html

Cheers,

Josh
 
Old 12-04-2011, 03:30 PM   #3
Arkam
LQ Newbie
 
Registered: Dec 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks Josh for this. I have tried this but its not working for me

curl -T file1.dat hostname --user username: password -Q "-rename /home/metapack/Dms\ Files/UKMail/file1.dat /home/ftp/username/incoming/file1.mp4"

The file does gets uploaded but rename command simply fails
 
  


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
renaming multiple files linuxhippy Slackware 10 01-21-2011 01:53 AM
Variables in moving / renaming files using CURL to download Freaksta Linux - Software 3 08-30-2010 09:13 AM
Renaming Multiple files Viablade Linux - Newbie 1 02-11-2009 01:47 PM
Renaming multiple files Changes Linux - Newbie 1 02-01-2009 09:58 PM
renaming multiple files yanchina12 Linux - Newbie 5 12-21-2007 07:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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
Open Source Consulting | Domain Registration