Linux: when mv fails, is the original file still intact? [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I used the mv command on a file then this message appeared:
mv 'file.tar': Disk quota exceeded
but now there is a file.tar in both the new location and the old location. They're different sizes and I have no idea what the size of the original file was. (There are a lotttt of files in this tarball)
Can I just delete the file that failed to get moved or will I lose part of my original data if I do that?

When Unix/Linux mv(1)-es a file, if source and destination are on the same filesystem, it is just a rename. This can't give an "out of space" message (at least not AFAICS). When moving a file between filesystems (different partitions or disks), what is done is to copy the source to the destination, and when the operation suceeds, the source is deleted. During the copying the destination filesystem can run out of space, and the source won't be deleted. It is strange that the (partial) destination stays in your case, in my experience mv cleans that up (but it's been a while...). In this case the user to which the target file belongs is running out of allowed disk space.

Related

Why rsync failed to copy all files? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I tried to copy 17171 files, but whatever parameters I use, it always copied 17160 which 11 lost.
But same command for another directory, copied accurately. (16545 files).
I also tried use cp, but also lost 11 files.
When I check the folder with finder, it should be 17171 files there...
rsync -arvz src dst
cp src dst
Above is the command I've tried
There can be a number of issues at play:
One of the more common issues is that the target filename is illegal on the remote system, for example trying to copy a file with a colon : in the filename from UNIX to Windows.
There may also be permission issues reading the files that are not copied, check the permissions here.
Finally, you could try zipping (or taring) the bunch of files into a single file, and transfer just that instead. Typically you'll see the problem when unpacking that file on the remote system.
EDIT: Another thought - are the files that did not copy really-really large, too large to store remotely?
If you rsync with the -P option, it should only re-transfer files that were not copied. It will also print progress, that should give you a better idea of what's not copying.

Why not "mv -r" in Linux bash? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
Well, I know you have to use -r with cp and rm when dealing with directories. It makes this job recursively (meaning it coping and removing all starting with things inside).
But why you dont do "mv -r" when moving / renaming directories?
Directories are just collections of pointers to locations of files on the filesystem. When you move a directory you are updating the file pointers of the new and old parents to contain/remove the one you moved. Thus, child file pointers inside do not require recursive action as none of the pointer locations have actually changed for them.
EDIT: I've just found a much more detailed answer on Unix & Linux StackExchange that will help explain this further.
https://unix.stackexchange.com/questions/46066/why-unix-mv-program-doesnt-need-r-recursive-option-for-directories-but-cp-do
For every move, new location is needed.
If one wants to move all files under directory alongwith the directory, just move the directory which is recursive.

Recover deleted file after full disk [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I was editing a file in nano and, when I saved it, I got a disk is full error. However, when I opened the file again, all it's content was gone, including everything that was there before the disk was filled. How can I recover the file's content? My partition type is EXT4. I've already tried recovering it using debugfs with no success.
Thanks in advance.
I've managed to get my file back by dumping an image of the SD card then grepping the strings output of the block file for "signatures" I remembered of the file. After getting the line number, I just cropped the output and saved it to a file.

Hidden folder showing ~lock file? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I am just preparing a doc file. i am using LibreOffice in ubuntu.
The name of the file is
WebApplicationRequirements.doc
When i am saving that in a drive, an extra file shows in the hidden file.
The name is
.~lock.WebApplicationRequirements.doc#
When i am pushing that in a remote repository it is including that hidden file. If i delete that fill will it harm the original file. And why it is happening?
As the name suggests, that hidden file is a lock file used internally by LibreOffice. To prevent multiple LibreOffice application instances from writing to the same file at the same time. It's not generally harmful to delete that file. It should get re-created again next time you open that file again in LibreOffice.
You haven't indicated what remote repo system you are using. But also note that most repro systems (e.g. git) have the concept of ignore files which allow you to configure which files to ignore during commit. If your repro system has that you probably want to add a rule to ignore the lock files so that they are not committed/pushed.

Recover deleted Excel file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
A strange thing happened. A file my father was working in one of his Excel files was corrupted while he was saving it, resulting in the file being deleted.
Of course he didn't delete the file himself. Needless to say he came to me to find a solution.
So after some Googling I came up with a file recovery tool (PC Inspector File Recovery) and I found a deleted file.
The only problem is, the size of that file is less than 1kB, but it is an .xlsx file. Among that file there are also two other .tmp files, one is dating from a minute after the .xlsx-file was last edited, the other 6 hours later from the .xlsx-file. Both files are 171kB in size.
I'm suspecting the data from the original excelfile is in those files (I think the second file, is some copy of the first tmp file).
Does anyone know if I can restore these tmp-files into the original Excel file?
Have you tried just renaming it from .tmp to .xls and seeing if it would open?

Resources