Please Help CP CANNOT STAT issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Please Help CP CANNOT STAT issue
# 1  
Old 10-11-2013
Please Help CP CANNOT STAT issue

Hi All,

I am getting the below error can anyone please help with this?
Code:
 
cp ${AI_SERIAL}/file_name ${AI_SERIAL_ARCH}/${ODATE}_file_name
cp: cannot stat `$AI_SERIAL/FILE_NAME': No such file or directory
+ gzip:$AI_SERIAL_ARCH./$ODATE_FILE_NAME
gzip:$AI_SERIAL_ARCH./$ODATE_FILE_NAME: No such file or directory

Apologies I cant give directory name and file names as we cant disclose it.I am just copying the file from AI_SERIAL to AI_SERIAL_ARCH DIRECTORY and then zipping that file.File in Ai_serial directory is as below : eg

abc.dat and I have copied in ai_serial_arch directory as 20131011_abc.dat

Thanks.Please help.

Last edited by vbe; 10-11-2013 at 12:19 PM.. Reason: code tags + typos
# 2  
Old 10-11-2013
It looks like, your paths are not correct.
# 3  
Old 10-11-2013
Quote:
Originally Posted by bhanudhingra
Hi All,

I am getting the below error can anyone please help with this?
Code:
 
cp ${AI_SERIAL}/file_name ${AI_SERIAL_ARCH}/${ODATE}_file_name
cp: cannot stat `$AI_SERIAL/FILE_NAME': No such file or directory
+ gzip:$AI_SERIAL_ARCH./$ODATE_FILE_NAME
gzip:$AI_SERIAL_ARCH./$ODATE_FILE_NAME: No such file or directory

Apologies I cant give directory name and file names as we cant disclose it.I am just copying the file from AI_SERIAL to AI_SERIAL_ARCH DIRECTORY and then zipping that file.File in Ai_serial directory is as below : eg

abc.dat and I have copied in ai_serial_arch directory as 20131011_abc.dat

Thanks.Please help.
You could at least give us a consistent command lines and diagnostic messages.

Showing us command lines and diagnostics that don't match tells us that you're wasting our time and don't really want our help. Not showing us representative samples of your code and data tells us that you're wasting our time and don't really want our help.

I'll give you a free pass once and make some wild guesses at what might be wrong. First, cp will never give you a diagnostic message starting with gzip:. Second, neither cp nor gzip will translate a file's name presented in lowercase on the command line to uppercase in diagnostic messages.

In theory, it is possible that the command line:
Code:
cp ${AI_SERIAL}/file_name ${AI_SERIAL_ARCH}/${ODATE}_file_name

could produce the diagnostic:
Code:
cp: cannot stat `$AI_SERIAL/file_name': No such file or directory

if you defined the variable AI_SERIAL using something like:
Code:
AI_SERIAL='$AI_SERIAL'

, but it seems more likely that your cp command is using quotes that you haven't shown us and you're using the wrong quotes. By any chance, did your real cp command look more like:
Code:
cp '${AI_SERIAL}/FILE_NAME' '${AI_SERIAL_ARCH}/${ODATE}_FILE_NAME'

with single quotes surrounding the pathnames? If so, change the single quotes to double quotes (in your cp command AND in your gzip command) and you might get something closer to what you wanted.

If you want our help in the future, please be aware that at the very least you need to show us EXACT replicas of the commands you're running (you can change the names if you want; but any uses of quotes must be shown exactly as they appear in your script). If you're going to give us replicas of your commands, please be sure that any transformations you make to your commands are also be made to the diagnostic messages your actual command produces.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Is "stat: illegal option -- -" an issue with hyphenated filename or flag problem?

Hi. I'm trying to install VMWare Workstation to run a virtual machine on my Mac OS, but running the bundle from bash(xterm) sh VMware-workstation-Full-11.0.0-2305329.x86_64.bundle (as suggested in install guide) comes up with error:stat: illegal option -- - usage: stat Digging... (5 Replies)
Discussion started by: defeated
5 Replies

2. UNIX for Dummies Questions & Answers

Help with stat command

Hi Experts, I am here with very simple request: #!bin/bash a=`stat -c %y log1.csv` echo $a and this stat command returning value as 2013-08-11 05:42:10.000000000 -0400: But I want to see in mm/dd/yyyy format? any help is highly appreciated thank you ---------- Post... (9 Replies)
Discussion started by: parpaa
9 Replies

3. Shell Programming and Scripting

Stat value changes

Die to what all operations, the "Modify" and "Change" values of stat output changes for a file. I found, during editing a file, Change and Modify alters. When chmod'ing Change alters, while Modify doesnot alters. Is there more situations where these changes? (1 Reply)
Discussion started by: anil510
1 Replies

4. UNIX for Dummies Questions & Answers

Stat command

i know this command does not exist in solaris. however, i read somewhere on this forum that basically everything the stat command provides in other oses can be obtained in solaris using the ls command. i've searched the forum for a while now and i cant find the thread. does anyone know about... (1 Reply)
Discussion started by: SkySmart
1 Replies

5. Shell Programming and Scripting

stat command with ls -l

If i do ls -l i get the result rwx-rw-r ...... ............... file. How can i get the result in octal format. All other output will be the same as ls -l shows. The rwx-rw-r would be like 755 etc. (7 Replies)
Discussion started by: cola
7 Replies

6. Programming

Q with stat()

From reading various articles on the net, I know stat() is used on files to get things like permissions, sizes etc... As a folder is a special type of file in Unix, I assumed that stat() could work on it as well as any general file. However, from running my program, perror() reported that the... (3 Replies)
Discussion started by: JamesGoh
3 Replies

7. UNIX for Advanced & Expert Users

stat

the output of stat command is Size: 238 Blocks: 8 IO Block: 4096 regular file Device: 80ah/2058d Inode: 736783 Links: 1 Access: (0664/-rw-rw-r--) Uid: ( 500/ gajju) Gid: ( 500/ gajju) Access: 2008-09-08 20:00:15.000000000 +0530 Modify: 2008-09-08... (6 Replies)
Discussion started by: gajju
6 Replies

8. UNIX for Dummies Questions & Answers

Cannot stat?

Hi! I ran into a problem with a job I'm running. All it is doing is a "touch" on a filename. However, when I ran the job, it error'd out and got the message 'cannot stat'. When I restarted the job (making no changes) it worked just fine. Anyone know what this means? (1 Reply)
Discussion started by: lgardner
1 Replies

9. Programming

Need help with scandir / stat

I'm writing a file manager program using FC3 and C, and I'm having a problem displaying the stat info of subdirectories. #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> int main() { char *dirname = "mydirectory"; struct dirent **namelist; ... (2 Replies)
Discussion started by: Bertsura
2 Replies

10. Shell Programming and Scripting

stat command

how can ý use "stat command"????.. (2 Replies)
Discussion started by: emreatlier
2 Replies
Login or Register to Ask a Question