If you are trying to copy files from multiple source directories into a single target directory, why does a checksum on a source file or on a target file matter? Only one file with a given name can exist in your target directory. Why does a checksum matter in deciding whether or not you want to replace an existing file in your destination directory?
I took it as to prevent copying the same files with different names.
Hi 1in10,
I am going to address just your initial follow up post after my suggestion in post #2, since you appear to be a moving target.
Quote:
xargs: unmatched simple quotes ; by default quotes are special to xargs unless you use the -0 option
This happens because xargs does not like to receive arguments in the input stream if they contain a single unmatched quote. Apparently, some of your songs have apostrophe in their file names.
Quote:
cp: calling of stat for „/home/directory/origin/transit/World Party - Goodbye Jumbo - 05 - Aint Gonna Come Till Im Ready.mp3“ not possible: file or directory not found.
The meaning of this error is that cp cannot find a song named "World Party - Goodbye Jumbo - 05 - Aint Gonna Come Till Im Ready.mp3" in the directory /home/directory/orgin/transit to copy.
Go manually there and check if that file exist as is reported by the error.
Pay attention if Aint has an apostrophe in the real file as Ain't . If it does, then after passing through all the piping the apostrophe is being removed.
To address the issue of the apostrophe, I am not quite sure if any of the following techniques might help, but you may try:
The command tr will switch any newline for a NULL and then I am telling xargs to separate the arguments by NULL, doing this in my version, it does ignore the apostrophe and it let it be alone. I am following the suggestion given by the original error:
Quote:
by default quotes are special to xargs unless you use the -0 option
In this version, sed is escaping any apostrophes; by the time xargs sees the stream they are protected by a `\' and treated correctly. That's the hope.
Quote:
[...]Something went wrong. And the directory with the content of hundreds of subdirectories just contains one single tune.[...]
This could happen if the whole process stopped prematurely, or if sha256sum tagged those files with the same hash, which sort -u would have removed from the stream passed to xargs.
You can troubleshoot that by just running part of the command up to sha256sum and checking manually what's being done there.
Code:
find /home/directory/origin -type f -iname "*.mp3" -exec sha256sum {} \+
Check the hash of some of those file that you consider missing.
Hi
I'll be getting a directory path as the input to the script.
E.g. 1 abc/fsg/sdfhgsa/fasgfsd/adfghad/XXX/fhsad
e.g. 2 sadfg/sadgjhgds/sd/dtuc/cghcx/dtyue/dfghsdd/XXX/qytq
This input will be stored in a variable.
My query is how to extract the field in a variable VAR which occurs... (15 Replies)
Hi Everyone,
It would be helpful if someone helps me on this.
Requirement:
I have a directory which includes different types of files(for example *.java,*.class),but not restricted for only these types. I need to find the same types of file extensions from its directories and subdirectories... (3 Replies)
Hi guys. I'm doing some bash scripting and have run into a snag.
Say I have the path:
/home/one/two/three/
All I need is the 'three' while making a filename.
Is there an easy way to do this? I've tried using grep (because I'm that smart.) cut (as I'm unable to tell how many fields there... (3 Replies)
Hello everyone,
I am trying to make a script in KSH that will zip an entire directory but leave out one file in that directory. I then need to send that zipped directory to another UNIX box. I am new to UNIX and would appreciate a good template to study from. (3 Replies)
I need to fit in a module in my Korn Shell script which would extract file_archive.tar.gz residing in the folder /apps/Test of my local machine into a folder /global/ in a remote machine server1.
Please help me on this regard.
Thanks
Kumarjit. (2 Replies)
Hello,
I need to write a script to check directory size on a linux server.
I do not have access to some directories Inside the directory tree so I've got some warning in the output that say :
du : cannot read directory ....
Could you please help me. I did try Inside of my script to... (2 Replies)
Hi,
I would like to achieve below requirement,
I have a directory "/mydir" and I want to automatically sync/copy all the content of /mydir directory to "/yourdir" directory all the time.
meaning, if some application creates a file in /mydir, it supposed to be copied/available in "/yourdir"... (4 Replies)
I have a file, in Windows, called php_0.27.tar.gz and want to extract it to
C:\Program Files\PHP\script through Cygwin using this command:
tar -xf php_0.27.tar.gz -C /Program Files/PHP/script But I got an error saying:
tar: Files: Not found in archive
I tried this command too:
... (8 Replies)
Dear Experts,
I have some directory structure something like follows. I would like to cut portion of it. Would you please help me? I have to run this on several sql's. The directory path is dynamic. I have cut what comes after first "sql" string.
Input:... (3 Replies)