file-copy

Hard link as destination of cp and rsync

Hard link as destination of cp and rsync Where do I find documentation of behavior of cp and rsync commands when the destination path shares the inode with another path? In other words, when I do $ cp [options] src dest $ rsync [options] src dest and when there is dest2 that is a hard …

Total answers: 1

Copy new files from NAS to External Hard Drive with rsync

Copy new files from NAS to External Hard Drive with rsync I want to copy new files from my NAS to my external hard drive. I did copy the new files manually up to this point. Now I want to use a script to automate this for me. However everything I tried so far with …

Total answers: 1

How to recursively create .sha256 hash files for every file in a folder?

How to recursively create .sha256 hash files for every file in a folder? Example I have these files /sdcard/testfolder/file1 /sdcard/testfolder/file2 /sdcard/testfolder/file3 /sdcard/testfolder/file4.ext I would like to create .sha256 files for each /sdcard/testfolder/file1.sha256 /sdcard/testfolder/file2.sha256 /sdcard/testfolder/file3.sha256 /sdcard/testfolder/file4.ext.sha256 The method should work on every possible valid character in the file names and folder names My starting point was …

Total answers: 1

why is NFS copy speed half that of SSH scp?

why is NFS copy speed half that of SSH scp? RHEL 7.9 x86-64 high end dell servers with Xeon cpu’s, 512gb ram, intel nic card I am the only user on the server(s), and there is no other work load on them cisco 1gbps wired LAN data.tar is ~ 50 gb /bkup is NFS mounted …

Total answers: 1

Change owning user and group on file creation

Change owning user and group on file creation I have an issue where I want to connect a very old system (UNIX) to a new machine. This old machine logs in by scp using a hardcoded oldsystemaccess user and copies a file into a subdirectory of the new servers webroot /var/www/newserver/test/import. The new machine is …

Total answers: 1

How can I copy a /tmp/ directory that is created & deleted by a process?

How can I copy a /tmp/ directory that is created & deleted by a process? I am investigating the behavior of a binary on Oracle Linux 9 (XFS filesystem). This binary, when called by a process, creates a directory under /tmp and copies some files to it. This directory gets a randomized name each time …

Total answers: 4

Copying files from USB drive fails – I/O error or Invalid Argument

Copying files from USB drive fails – I/O error or Invalid Argument I’m trying to copy files from an USB stick to another drive. At least the file names appear to be corrupt, ls shows them as: ‘ZHECMIv’$’27”.PDF’ ‘ZHEKMI>2.P─F’ ZHENIL~1.PDF ‘эeloѤyfɯrɥvdr.2uOroä䁲igez_o_聴eŢe’$’340240256”Ű聤f’ ‘ၙan­P⁩ѥòѳen-ၐoint-M䁯rѴ&`df’ Copying fails with errors like these: cp: error reading ‘/media/pg/VERBATIM/2012/03/MVANES~0.PDF’: Input/output error cp: …

Total answers: 1

Setting ownership when copying or syncing files

Setting ownership when copying or syncing files When moving or copying files as root I often want to set the ownership for those files based on the owner of the directory I am moving the files to. Before I go off and write a script that parses the rsync output for all the files that …

Total answers: 2

File order on FAT/FAT32/VFAT file systems

File order on FAT/FAT32/VFAT file systems I have several audio devices (car radio, portable radio, MP3 player) that take SD cards and USB sticks with a FAT file system on it. Because these devices have limited intelligence they do not sort filenames on the FAT FS by name but merely play them in the order …

Total answers: 2

How does ZFS copy on write work for large files

How does ZFS copy on write work for large files Let’s say I have a large file (8GB) called example.log on ZFS. I do cp example.log example.bak to make a copy. Then I add or modify a few bytes in original file. What will happen? Will ZFS copy the entire 8GB file or only the …

Total answers: 2

Moving millions of files to a different directory with specfic name patterns

Moving millions of files to a different directory with specfic name patterns I have millions of files with the following nomenclature on a Linux machine: 1559704165_a1ac6f55fef555ee.jpg The first 10 digits are timestamp and the ones followed by a _ are specific ids. I want to move all the files matching specific filename ids to a …

Total answers: 5

Why are there no file insertion syscalls

Why are there no file insertion syscalls To my understanding, for manipulating files there is only the sys_write syscall in Linux, which overwrites the file content (or extends it, if at the end). Why are there no syscalls for inserting or deleting content in files in Linux? As all current file systems do not require …

Total answers: 2

systemd and copy (/bin/cp): no such file or directory

systemd and copy (/bin/cp): no such file or directory While manually copying the file the following works, as below: userx@x:~$ cp -rv /opt/test-bak/* /opt/test/ ‘/opt/test-bak/file1’ -> ‘/opt/test/file1’ ‘/opt/test-bak/file2’ -> ‘/opt/test/file2’ ‘/opt/test-bak/file3’ -> ‘/opt/test/file3’ ‘/opt/test-bak/subdir1/subfile1’ -> ‘/opt/test/subdir1/subfile1’ ‘/opt/test-bak/subdir2/subfile2’ -> ‘/opt/test/subdir2/subfile2′ However, installing it as a system service returns the “cannot stat ‘/opt/test-bak/*’: No such file or …

Total answers: 1

Timestamps of files copied to USB drive

Timestamps of files copied to USB drive I have a problem with the timestamps of files copied from my PC or laptop to USB drives: the last modification time of the original file and that of the copied file are different. Therefore, synchronizing files between my PC and my USB drive is quite cumbersome. A …

Total answers: 2

cp: cannot create regular file: Permission denied

cp: cannot create regular file: Permission denied I am running a PHP script on my Apache server and from the script I need to copy some files (to run a Bash script that copies files). I can copy to a directory /tmp with no problems, but when I want to copy to /tmp/foo then I …

Total answers: 1

What happens when I kill 'cp'? Is it safe and does it have any consequences?

What happens when I kill 'cp'? Is it safe and does it have any consequences? What are the consequences for a ext4 filesystem when I terminate a copying cp command by typing Ctrl + C while it is running? Does the filesystem get corrupted? Is the partition’s space occupied by the incomplete copied file still …

Total answers: 3