question in MV command (will move work with 100% used directory)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers question in MV command (will move work with 100% used directory)
# 1  
Old 09-19-2011
question in MV command (will move work with 100% used directory)

Dear all,

I am facing a issue in MV command, this move is done by our c program. We are moving the file to same directory so basically I think it will be a rename of the inode. So we might not useany extra space then why the move is failing. Does it require space to move the same size of file in same directory???
Code:
mv /amap/data/125m.029  /amap/data/125.029
mv /amap/data/125m.004  /amap/data/125.004
mv /amap/data/125m.020  /amap/data/125.020
mv /amap/data/125m.049  /amap/data/125.049
mv /amap/data/125m.030  /amap/data/125.030

mv: cannot move `/amap/data/125.030' to `/amap/data/125.030': 
No space left on device
Unable to perform move 
Command : mv -v /amap/data/125.030 /amap/data/125.030 "

Thanks,
Arun

Last edited by Scott; 09-19-2011 at 12:39 PM.. Reason: Code tags...
# 2  
Old 09-19-2011
Seems to be the same filename 125.030 in that error message. Are you doing something silly like
Code:
system("mv ...");

You can use rename(2) in libc, or link(2) and unlink(2).
# 3  
Old 09-19-2011
no that is my typo, this error is like
Code:
mv: cannot move `/amap/data/125m.030' to `/amap/data/125.030': 
No space left on device
Unable to perform move 
Command : mv -v /amap/data/125m.030 /amap/data/125.030 "



Last edited by Scott; 09-19-2011 at 12:39 PM.. Reason: Code tags...
# 4  
Old 09-19-2011
If you do not have "rename", you can use another directory where you know for sure there is enough space available and use it as a temp storage:
Code:
mv /amap/data/125m.029 /FreeDir/125.029
rm /amap/data/125m.029
mv /FreeDir/125.029 /amap/data/125.029

This will take more time due to the extra move, but it will accomplish what you want.
# 5  
Old 09-19-2011
agreed, but my question is will MV require space even though we are moving the same file in same directory with same size, only name is different .

see below i am moving the same size of file to the same directory that too with MV command. so i believe it will replace the inode.For that do we need space ???????

Code:
mv /amap/data/125m.029  /amap/data/125.029
mv /amap/data/125m.004  /amap/data/125.004
mv /amap/data/125m.020  /amap/data/125.020
mv /amap/data/125m.049  /amap/data/125.049
mv /amap/data/125m.030  /amap/data/125.030

mv: cannot move `/amap/data/125.030' to `/amap/data/125.030': 
No space left on device
Unable to perform move 
Command : mv -v /amap/data/125.030 /amap/data/125.030 "


Last edited by arunkumar_mca; 09-19-2011 at 02:02 PM.. Reason: make the correct code and text colour
# 6  
Old 09-20-2011
Answer:
YES for the mv command is similar to the cp command, except it copies the file then deletes the original...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Move multiple files to different directory using a single command

I have multiple files test1, test2, test3 etc. I want to move to a different directory with ABC_ prefixed to every file and and current dat time as postfix using a single command. (I will be using this is sftp with ! (command for local server). I have tried the following but it gives error ... (5 Replies)
Discussion started by: Soham
5 Replies

2. Shell Programming and Scripting

Shell script cannot create directory and move the file to that directory

I have a script, which is checking if file exists and move it to another directory if then mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly ... (9 Replies)
Discussion started by: digioleg54
9 Replies

3. UNIX for Dummies Questions & Answers

How to move gz files from one source directory to destination directory?

Hi All, Daily i am doing the house keeping in one of my server and manually moving the files which were older than 90 days and moving to destination folder. using the find command . Could you please assist me how to put the automation using the shell script . ... (11 Replies)
Discussion started by: venkat918
11 Replies

4. Shell Programming and Scripting

List files with date, create directory, move to the created directory

Hi all, i have a folder, with tons of files containing as following, on /my/folder/jobs/ some_name_2016-01-17-22-38-58_some name_0_0.zip.done some_name_2016-01-17-22-40-30_some name_0_0.zip.done some_name_2016-01-17-22-48-50_some name_0_0.zip.done and these can be lots of similar files,... (6 Replies)
Discussion started by: charli1
6 Replies

5. Shell Programming and Scripting

Move the latest or older File from one directory to another Directory

I Need help for one requirement, I want to move the latest/Older file in the folder to another file. File have the datetimestamp in postfix. Example: Source Directory : \a destination Directory : \a\b File1 : xy_MMDDYYYYHHMM.txt (xy_032120101456.txt) File2: xy_MMDDYYYYHHMM.txt... (1 Reply)
Discussion started by: pp_ayyanar
1 Replies

6. Shell Programming and Scripting

Question about move command

Is there a way to undo a move after running a command such as this: find ./* -type f -name "*.pdf" -exec mv {} /new/dir \; :confused: (3 Replies)
Discussion started by: bbbngowc
3 Replies

7. Shell Programming and Scripting

Move a file from windows directory to unix directory

Move a file from windows directory to unix directory, is this possible? if it is, can someone help me on this? Thanks! God bless! (1 Reply)
Discussion started by: kingpeejay
1 Replies

8. UNIX for Dummies Questions & Answers

.ssh directory question (Can i move it)

Hi All, pn:/wrk/an/tran/cr>) ls -ld .ssh drwx------ 2 crcv1ftp canusr 96 May 2 2007 .ssh I had .ssh directory inside a directory . When i trying to do find and delete automatic script . The find comman is failing saying it dont have permision to read .ssh . Can i move... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

9. UNIX for Dummies Questions & Answers

Getting current work directory in Command Prompt

How to get the current working directory as part of the command prompt? Every time I chage the folder, my command prompt path shoud change. I am using Korn Shell. Any help is greatly appreciated. (3 Replies)
Discussion started by: MeganP
3 Replies
Login or Register to Ask a Question