Unable to copy files due to many files in directory

I have directory that has some billion file inside , i tried copy some files for specific date but it's always did not respond for long time and did not give any result.. i tried everything with find command and also with xargs..

even this command

find . -mtime -2 -print | xargs ls -d

did not give any result on console.

Is there any solution to fix this.

Thanks in Adv

Try it this way:

find . -mtime -2 -type f -print | xargs -l ls -ld

If you have a billion files in a directory, anything you try to do accessing a file in that directory is going to take a LONG time. In this case you have to read the directory twice for each file found that is less than 48 hours old. You said you're copying files, but there is nothing in the command line you listed that will copy anything. The command line you gave will search for groups of names of files that have been modified within the last 48 hours and then read the directory again for each group to print the names of those files.

The time needed to run this pipeline would probably be cut in half (while producing the same results except that the order in which the files are printed may be different) if you used the command:

find . -mtime -2

instead of the command:

find . -mtime -2 -print | xargs ls -d

Note that if a lot of files have been changed in the last two days, neither of these will give you a sorted list of the files that have changed.

Note also that if any filenames in the file hierarchy rooted in the current directory contain a space, tab, or newline character, the command you have using xargs will fail, and the output from the replacement command I suggested may be ambiguous.