I have the folder path in LINUX (Ubuntu) as follows:
/data/nldas/raw/hourly/
in the hourly folder I have sub-folders from 1979 to 2016 and in each year folder I have julian day folders from 1 to 365/366. In each julian day folder, I need to copy NLDAS_VIC0125_H.*.grb
files to a different destination in LINUX path e.g. /datadg/name/soil
. I do not want the same folder structure in the destination path.
Can somebody help me to do in LINUX please?
Thanks in advance.
Error:
\name@lin-v01:/$ find /datadg/RND_Data/ldas/raw/hourly/ -type f -name 'NLDAS_VIC0125_H.*.grb \ -print0 | xargs -0 cp --target-directory=/datadg/rndFS/name/soilM
find /datadg/RND_Data/ldas/raw/hourly/ -type f -name 'NLDAS_VIC0125_H.*.grb \ -print | xargs -0 cp --target-directory=/datadg/rndFS/name/soilM
find: warning: Unix filenames usually don't contain slashes (though pathnames do). That means that '-name `NLDAS_VIC0125_H.*.grb \\ -print | xargs -0 cp --target-directory=/datadg/rndFS/name/soilM\nfind /datadg/RND_Data/ldas/raw/hourly/ -type f -name NLDAS_VIC0125_H.*.grb'' will probably evaluate to false all the time on this system. You might find the '-wholename' test more useful, or perhaps '-samefile'. Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ `NLDAS_VIC0125_H.*.grb \\ -print | xargs -0 cp --target-directory=/datadg/rndFS/name/soilM\nfind /datadg/RND_Data/ldas/raw/hourly/ -type f -name NLDAS_VIC0125_H.*.grb''.
find: paths must precede expression: -print
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
cp: missing file operand
Try `cp --help' for more information.