Sponsored Content
Top Forums Shell Programming and Scripting Move files from one directory to another in chunks Post 303002311 by rbatte1 on Tuesday 22nd of August 2017 05:50:49 AM
Old 08-22-2017
You could be simpler with xargs and a call to another mini-script. A starter might be something like:-
Code:
$ cat my_mover.sh
#!/bin/bash
#my_mover.sh script actually does the work

target_dir=$1                 # Grab the target directory
shift                         # Chop off the target directory to just leave all the files listed

mv $@ $target_dir             # Take all arguments and move them to the target directory
sleep 1

You can then run something like this:-
Code:
find $dir1 -maxdepth 1 -type f | xargs -n 100 $dir2 my_mover.sh

This will move 100 files at a time (specified by the xargs parameter after -n)




I hope that this helps,
Robin
This User Gave Thanks to rbatte1 For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Move all files in a directory tree to a signal directory?

Is this possible? Let me know If I need specify further on what I am trying to do- I just want to spare you the boring details of my personal file management. Thanks in advance- Brian- (2 Replies)
Discussion started by: briandanielz
2 Replies

2. UNIX for Dummies Questions & Answers

How to move files between 2 dates from one directory to another

Hi All, I am coding for a requirement where I need to move files (filename.yymmdd) from one directory(A) to another(B) based on 2 date fields in a paramtere file. (Paramfile.txt) For e.g: In Paramfile.txt, BUS_DT =20120612 SUB_DT =20120602 In this case, i need to move all the files... (14 Replies)
Discussion started by: dsfreddie
14 Replies

3. UNIX for Dummies Questions & Answers

Zip all files in a directory and move to another directory

Hi, need to zip all files in a directory and move to another directory after the zip.. i am using this one but didnt help me... zip -r my_proj_`date +%Y%m%d%H%MS`.zip /path/my_proj mv in_proj_`date +%Y%m%d%H%M%S`.zip /path/source/ i am trying to zip all the files in my_proj... (0 Replies)
Discussion started by: dssyadav
0 Replies

4. Shell Programming and Scripting

Process files in a directory and move them

I have a directory e2e_ms_xfer/cent01 this contains the multiple files some of which will be named below with unique date time stamps e2e_ms_edd_nom_CCYYMMDD_HHMM.csv What I want to do is in a loop 1) Get the oldest file 2) Rename 3) Move it up one level from e2e_ms_xfer/cent01 to... (1 Reply)
Discussion started by: andymay
1 Replies

5. UNIX for Dummies Questions & Answers

Rename files in a directory and move them

I have a directory e2e_ms_xfer/cent01 this contains the multiple files some of which will be named below with unique date time stamps e2e_ms_edd_nom_CCYYMMDD_HHMM.csv What I want to do is in a loop 1) Get the oldest file 2) Rename 3) Move it up one level from e2e_ms_xfer/cent01 to... (1 Reply)
Discussion started by: andymay
1 Replies

6. Shell Programming and Scripting

List files with date, create directory, move to the created directory

Hi all, i have a folder, with tons of files containing as following, on /my/folder/jobs/ some_name_2016-01-17-22-38-58_some name_0_0.zip.done some_name_2016-01-17-22-40-30_some name_0_0.zip.done some_name_2016-01-17-22-48-50_some name_0_0.zip.done and these can be lots of similar files,... (6 Replies)
Discussion started by: charli1
6 Replies

7. UNIX for Beginners Questions & Answers

Move all files one directory level up

I want to move all the files in a given directory up one level. For example: Dir1 Subdir1 I want to move all the files in Subdir1 up to Dir1 (then I want to ultimately delete Subdir1) Thanks, Ted (10 Replies)
Discussion started by: ftrobaugh
10 Replies

8. UNIX for Dummies Questions & Answers

How to move gz files from one source directory to destination directory?

Hi All, Daily i am doing the house keeping in one of my server and manually moving the files which were older than 90 days and moving to destination folder. using the find command . Could you please assist me how to put the automation using the shell script . ... (11 Replies)
Discussion started by: venkat918
11 Replies

9. Shell Programming and Scripting

How Create new directory and move files to that directory.?

Hi All, We have main directory called "head" under this we have several sub directories and under these directories we have sub directories. My requirement is I have to find the SQL files which are having the string "procedure" under "head" directory and sub directories as well. And create... (14 Replies)
Discussion started by: ROCK_PLSQL
14 Replies
dpkg-name(1)							  dpkg utilities						      dpkg-name(1)

NAME
dpkg-name - rename Debian packages to full package names SYNOPSIS
dpkg-name [option...] [--] file... DESCRIPTION
This manual page documents the dpkg-name program which provides an easy way to rename Debian packages into their full package names. A full package name consists of package_version_architecture.package-type as specified in the control file of the package. The version part of the filename consists of the upstream version information optionally followed by a hyphen and the revision information. The package-type part comes from that field if present or fallbacks to deb. OPTIONS
-a, --no-architecture The destination filename will not have the architecture information. -k, --symlink Create a symlink, instead of moving. -o, --overwrite Existing files will be overwritten if they have the same name as the destination filename. -s, --subdir [dir] Files will be moved into a subdirectory. If the directory given as argument exists the files will be moved into that directory oth- erwise the name of the target directory is extracted from the section field in the control part of the package. The target directory will be `unstable/binary-architecture/section'. If the section is not found in the control, then `no-section' is assumed, and in this case, as well as for sections `non-free' and `contrib' the target directory is `section/binary-architecture'. The section field isn't required so a lot of packages will find their way to the `no-section' area. Use this option with care, it's messy. -c, --create-dir This option can used together with the -s option. If a target directory isn't found it will be created automatically. Use this option with care. -?, --help Show the usage message and exit. -v, --version Show the version and exit. EXAMPLES
dpkg-name bar-foo.deb The file `bar-foo.deb' will be renamed to bar-foo_1.0-2_i386.deb or something similar (depending on whatever information is in the control part of `bar-foo.deb'). find /root/debian/ -name '*.deb' | xargs -n 1 dpkg-name -a All files with the extension `deb' in the directory /root/debian and its subdirectory's will be renamed by dpkg-name if required into names with no architecture information. find -name '*.deb' | xargs -n 1 dpkg-name -a -o -s -c Don't do this. Your archive will be messed up completely because a lot of packages don't come with section information. Don't do this. dpkg-deb --build debian-tmp && dpkg-name -o -s .. debian-tmp.deb This can be used when building new packages. BUGS
Some packages don't follow the name structure package_version_architecture.deb. Packages renamed by dpkg-name will follow this structure. Generally this will have no impact on how packages are installed by dselect(1)/dpkg(1), but other installation tools might depend on this naming structure. SEE ALSO
deb(5), deb-control(5), dpkg(1), dpkg-deb(1), find(1), xargs(1). Debian Project 2012-04-15 dpkg-name(1)
All times are GMT -4. The time now is 11:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy