LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 06:36 PM   #1
dnaqvi
Member
 
Registered: Oct 2009
Posts: 117

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, 06:48 PM   #2
dnaqvi
Member
 
Registered: Oct 2009
Posts: 117

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, 06:56 PM   #3
dnaqvi
Member
 
Registered: Oct 2009
Posts: 117

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, 02:44 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
"\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, 01:00 PM   #5
dnaqvi
Member
 
Registered: Oct 2009
Posts: 117

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, 03: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



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 07:58 AM
File Browser on target - board -- URGENT !!!!!! plz parag_opensrc Linux - Software 3 09-17-2009 04:52 AM
Source Directory for Target Kernel halfpower Debian 1 05-22-2006 10:48 AM
Specifying target directory for command in bash shell script? spectrescape Programming 1 07-22-2004 05:37 PM
samba + target directory robyso Linux - Networking 0 07-11-2003 05:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:58 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