I am in a situation where I have some hundreds of thousands of files in a directory (name of directory: big_directory). Now, working on this directory is extremely slow.
I now plan to do this:
Copy 1000 files in each of the directories by creating the directories automatically. All files have .dat extension in the directory and have names like 1.dat, 2.dat, 3.dat until the last file number
This is what I intend to do:
1. Automatically create a directory "dir1" and copy first 1000 ".dat" files (present in big_directory) in it.
2. Automatically create a directory "dir2" and then copy the next 1000 ".dat" files (present in big_directory) in it.
3. Automatically create a directory "dir3" and then copy the next 1000 ".dat" files (present in big_directory) in it.
4. and so on until last file
I am using Linux with BASH. I know how to copy first 1000 files but not sure how to create directories automatically using a counter and copy them there.
Hi Guys,
I need to copy the files to respective directories based on name of the file. My script is something like below
con=$1
for file in `cat $con`
do
file_tmp=$(ls -t1 $path| grep -i $file | head -n 1)
echo $file_tmp
if
then
cp $path$file_tmp $DIR/ap
if
then... (16 Replies)
I've got this script to loop through all folders and move files that are more than 2 years old. I'm using the install command because it creates the necessary directories on the destination path and then I remove the source. I'd like to change the script to use the mv command since it is much... (4 Replies)
how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex.
so
mydemo--2015-03-23-1500.tar.gz
> database
-... (5 Replies)
Hi,
I am looking for the syntax to provide a timestamped log_file in expect.
Basically I want the equivalent of:
/outputs/`date +%d%m%y`/session`date +%H%M`
But scripted in expect so it can be handed over to the logfile function.
I have tried playing around with the timestamp... (1 Reply)
Hello all.
I have a tar file that contains a number of files that are stored in different directories.
If I extract this tar file with -xvf , the directories get created.
Is there a way to extract all of the files into one directory without creating the directories stored in the tar file. (9 Replies)
how can i copy those files into other directories have the same name but different in the end
i have files in directory called test:
10_10_asdadfsdfad.txt
10_10_11_asdawqefwkjasd.txt
10_10_11_12_asdafjjhoqwd.txt
i want to put them in exist directory thart i have on my system
i have... (1 Reply)
Hello all,
I'm trying to copy all files within a specified directory to another location based on a find filter of mtime -1 (Solaris OS). The issue that I'm having is that in the destination directory, I want to retain the source directory structure while copying over only the files that have... (4 Replies)
Hi guys,
I want to copy folder and sub folders only. I don't want the files. If i use cp -r command it will copy entirely with files.
Could any one suggest me.
Thanks in advance (1 Reply)
I have a security system that FTPs the camera files to my machine, however I want to sort the pictures (taken every 30s) into directories by hour.
Every picture uses the following file format.
yymmddhhmmsstt.jpg (where tt is the milliseconds)
I am thinking the for loop is best
for file... (11 Replies)
I have a report file that is generated every day by a scheduled process.
Each day the file is written to a directory named .../blah_blah/Y07/MM-DD-YY/reportmmddyy.tab
I want to copy all of this reports to a separate directory without having to do it one by one.
However, if I try
cp... (3 Replies)