Sponsored Content
Top Forums Shell Programming and Scripting Script to move all files in a dir into a certain dir Post 302657435 by ggmas on Sunday 17th of June 2012 04:40:54 PM
Old 06-17-2012
Try this:

Code:
#!/bin/bash
cmd=$(ls *.vector)
for f in $cmd
do
        directory=$(echo $f|awk -F . '{print $1}')
        mv $f $directory
done

I assumed that the directory where you want to put the .vector files and these files are in the same directory

Bye
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

a script to clone a dir tree, & overwrite the dir struct elsewhere?

hi all, i'm looking for a bash or tcsh script that will clone an empty dir tree 'over' another tree ... specifically, i'd like to: (1) specify a src directory (2) list the directory tree/hiearchy beneath that src dir, w/o files -- just the dirs (3) clone that same, empty dir hierarchy to... (2 Replies)
Discussion started by: OpenMacNews
2 Replies

2. Shell Programming and Scripting

grep files without header and move to new dir

Hi, i have number of files in a directory to be processed. the problem is some of the files does not have a header and the process is giving an error of no header found. example of good file : file1 HDR|20080803233401 record 1 record 2 TRA|2 example of a bad file in the same dir ... (6 Replies)
Discussion started by: sitaldip
6 Replies

3. Shell Programming and Scripting

need to move files of particular day from one dir to another dir

Hi, I have hundered's of files of the name CMP_PORT_IN_P200903271623042437_20090328122430_err.xml in error directory of todays date ie 20090328 and in the file name 5th field specifies date only now i want to move all files of 20090328 to another directory i.e reprocess directory. So... (3 Replies)
Discussion started by: ss_ss
3 Replies

4. Shell Programming and Scripting

A script to find dir, delete files in, and then del dir?

Hello!! I have directories from 2008, with files in them. I want to create a script that will find the directoried from 2008 (example directory: drwxr-xr-x 2 isplan users 1024 Nov 21 2008 FILES_112108), delete the files within those directories and then delete the directories... (3 Replies)
Discussion started by: bigben1220
3 Replies

5. Shell Programming and Scripting

want to move files in a dir into different directories based on the filename

I want to move the files in a dir to different dirs based on their file names. Ex: i have 4 different files with name - CTS_NONE_10476031_MRL_PFT20081215a.txt CTS_NONE_10633009_MRL_PFT20091020a.txt CTS_NONE_10345673_MRL_PFT20081215a.txt CTS_NONE_10872456_MRL_PFT20091020a.txt and the 1st... (4 Replies)
Discussion started by: Sriranga
4 Replies

6. Shell Programming and Scripting

moving files from a dir in one machine to a dir in another machines

Hi, I am a unix newbie.I need to write a shell script to move my oracle READ WRITE datafiles from one serevr to another. I need to move it from /u01/oradata/W1KK/.. to /u01/oradata/W2KK, /u02/oradata/W1KK/.. to /u02/oradata/W2KK. That is, I actaully am moving my datafiles from one database to... (2 Replies)
Discussion started by: mathews
2 Replies

7. UNIX for Dummies Questions & Answers

How to list all files in dir and sub-dir's recursively along with file size?

I am very new to unix as well as shell scripting. I have to write a script for the following requirement. In have to list all the files in directory and its sub directories along with file path and size of the file Please help me in this regard and many thanks in advance. (3 Replies)
Discussion started by: nmakkena
3 Replies

8. Shell Programming and Scripting

Need a script to move the files from one dir to other other dir

Need a script to move the files from one dir to other dir and at the same time it has to read the log in the source dir. Please help me ASAP. (4 Replies)
Discussion started by: viswanathkishor
4 Replies

9. Shell Programming and Scripting

KSH - Find paths of multiple files in CC (dir and sub-dir))

Dear Members, I have a list of xml files like abc.xml.table prq.xml.table ... .. . in a txt file. Now I have to search the file(s) in all directories and sub-directories and print the full path of file in a output txt file. Please help me with the script or command to do so. ... (11 Replies)
Discussion started by: Yoodit
11 Replies

10. AIX

Assign read write permission to the user for specific dir and it's sub dir and files in AIX

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. I do not want to assign user the same group of that directories too.... (0 Replies)
Discussion started by: blinkingdan
0 Replies
update-fonts-dir(8)					      System Manager's Manual					       update-fonts-dir(8)

NAME
       update-fonts-dir - compile fonts.dir files

SYNOPSIS
       update-fonts-dir [OPTION] directory ...

DESCRIPTION
       update-fonts-dir creates a fonts.dir file in an X font directory by invoking mkfontdir(1x) with the appropriate arguments.  It is typically
       invoked only from the post-installation and post-removal scripts of a package containing fonts for the X Window System, but may be  invoked
       at  any	time  to  reconstruct  fonts.dir  files.   For	each directory, which is simply the last component of its path (such as '75dpi' or
       'misc'), update-fonts-dir will generate either /usr/lib/X11/fonts/directory/fonts.dir or /usr/share/fonts/X11/directory/fonts.dir from  the
       fonts.scale and font files found within it.

       This  enables  multiple packages to provide names for fonts in the same directory.  No font package actually provides the fonts.dir file in
       the X font directory itself, so there is no danger of overwriting one package's font names with those of another.

       For instance, the two packages  'xfonts-base'  (real)  and  'xfonts-nifty'  (hypothetical)  may	both  install  fonts  into  the  directory
       /usr/lib/X11/fonts/misc,  and  update-fonts-dir	will  ensure that the fonts.dir file in that directory contains information about the font
       files provided by both packages.

       The format of fonts.dir files is described in the mkfontdir(1x) manual page.

       An example of how to use update-fonts-dir in package maintainer scripts is provided in the Debian Policy Manual.

OPTIONS
       -h, --help displays a brief usage message and exits.

       -7, --x11r7-layout switches the font layout to the one introduced in X11R7: fonts in /usr/share/fonts/X11/directory (default is:  fonts	in
       /usr/lib/X11/fonts/directory)

OPERANDS
       update-fonts-dir  takes	one or more X font directory names to operate on as operands.  Only the final path component of the directory name
       should be specified; e.g.,
	      update-fonts-dir 75dpi
       is correct, while 'update-fonts-dir /usr/X11R6/lib/X11/fonts/75dpi' and 'update-fonts-dir /usr/lib/X11/fonts/75dpi' are not.

ENVIRONMENT
       COLUMNS
	      indicates the width of the terminal device in character cells.  This value is used for formatting diagnostic messages.  If not  set,
	      the terminal is queried using stty(1) to determine its width.  If that fails, a value of '80' is assumed.

DIAGNOSTICS
   Errors
       usage error: one or more font directories must be provided
	      update-fonts-dir was invoked without operands.  Supply one or more X font directory names to operate on.

       usage error: unrecognized option
	      update-fonts-dir was invoked with an unrecognized option argument.  Use only the options documented in "OPTIONS", above.

       fatal error: path to X font directory must be used
	      A directory name was supplied that was not an X font directory name.  Supply X font directory names only.

   Warnings
       warning: absolute path directory was provided
	      Usage of absolute paths is deprecated.  Use only the final component of the X font directory name for directory.

       warning: directory does not exist or is not a directory
	      The supplied directory was invalid.  update-fonts-dir skipped it.

EXIT STATUS
       0      update-fonts-dir ran successfully.

       1      update-fonts-dir experienced a fatal error; see the section on diagnostic messages above.

       2      update-fonts-dir was invoked with invalid arguments.

BUGS
       See  the  Debian  Bug  Tracking	System <http://bugs.debian.org/xfonts-utils>.  If you wish to report a bug in update-fonts-dir, please see
       /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.

AUTHOR
       update-fonts-dir was written by Branden Robinson.

SEE ALSO
       mkfontdir(1x)

Debian Project							    2004-11-11						       update-fonts-dir(8)
All times are GMT -4. The time now is 10:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy