LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-22-2010, 07:36 PM   #1
dnaqvi
Member
 
Registered: Oct 2009
Posts: 116

Rep: Reputation: 15
cp: target \r' is not a directory --- URGENT thanks


Hello All,

I am running following commands and ist runs fine for me.

cp -r /mnt/datasource/* /opt/IBM/WebSphere/DataSource/

But if I put this command in script, it does not work.

vi cpydata
cp -r /mnt/datasource/* /opt/IBM/WebSphere/DataSource/
#save it
> chmod 777 cpydata
> ./cpydata
> cp: target `/opt/IBM/WebSphere/DataSource/\r' is not a directory

???
 
Old 04-22-2010, 07:48 PM   #2
dnaqvi
Member
 
Registered: Oct 2009
Posts: 116

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by dnaqvi View Post
Hello All,

I am running following commands and ist runs fine for me.

cp -r /mnt/datasource/* /opt/IBM/WebSphere/DataSource/

But if I put this command in script, it does not work.

vi cpydata
cp -r /mnt/datasource/* /opt/IBM/WebSphere/DataSource/
#save it
> chmod 777 cpydata
> ./cpydata
> cp: target `/opt/IBM/WebSphere/DataSource/\r' is not a directory

???
I am running as a root user.
 
Old 04-22-2010, 07:56 PM   #3
dnaqvi
Member
 
Registered: Oct 2009
Posts: 116

Original Poster
Rep: Reputation: 15
OS:zLinux, SuSE Linux Enterprise Server
echo $SHELL
/bin/bash


I have run in the morning and its work fine.
 
Old 04-23-2010, 03:44 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,557
Blog Entries: 28

Rep: Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178Reputation: 1178
"\r" is carriage return and may have arisen from creating the script using a Windows text editor. In Windows each line ends with "carriage return" and newline. In Linux each line ends with newline alone so any preceding carriage return is taken as part of the line.

The fromdos command can be used to convert Windows/DOS format files.

For a quick-and-dirty solution you can comment out the end of line
Code:
cp -r /mnt/datasource/* /opt/IBM/WebSphere/DataSource/    # comment to hide end of line garbage
 
1 members found this post helpful.
Old 04-23-2010, 02:00 PM   #5
dnaqvi
Member
 
Registered: Oct 2009
Posts: 116

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by catkin View Post
"\r" is carriage return and may have arisen from creating the script using a Windows text editor. In Windows each line ends with "carriage return" and newline. In Linux each line ends with newline alone so any preceding carriage return is taken as part of the line.

The fromdos command can be used to convert Windows/DOS format files.

For a quick-and-dirty solution you can comment out the end of line
Code:
cp -r /mnt/datasource/* /opt/IBM/WebSphere/DataSource/    # comment to hide end of line garbage
Yes, it was a format issue.
On one stage I move file to window PC through winscp tool.
I put back and its become corrupted.
I wrote another script with same code and its work.

Thanks
 
Old 04-23-2010, 04:18 PM   #6
Hi_This_is_Dev
Member
 
Registered: May 2009
Location: India
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254

Rep: Reputation: 18
Quote:
Originally Posted by catkin View Post
"\r" is carriage return and may have arisen from creating the script using a Windows text editor. In Windows each line ends with "carriage return" and newline. In Linux each line ends with newline alone so any preceding carriage return is taken as part of the line.

The fromdos command can be used to convert Windows/DOS format files.

For a quick-and-dirty solution you can comment out the end of line
Code:
cp -r /mnt/datasource/* /opt/IBM/WebSphere/DataSource/    # comment to hide end of line garbage


Catkin, thanks for the subtle point!
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] mv: target `filename' is not a directory dai_bach Programming 9 12-20-2012 08:58 AM
File Browser on target - board -- URGENT !!!!!! plz parag_opensrc Linux - Software 3 09-17-2009 05:52 AM
Source Directory for Target Kernel halfpower Debian 1 05-22-2006 11:48 AM
Specifying target directory for command in bash shell script? spectrescape Programming 1 07-22-2004 06:37 PM
samba + target directory robyso Linux - Networking 0 07-11-2003 06:07 AM


All times are GMT -5. The time now is 09:02 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration