I need to move a bunch of files into folders that have the same name. I wanted to either do this with some filter command or some type of batch file that I could save that would already include all of the mv commands since I will have to do this process often. Whatever method you think is easier.
... (7 Replies)
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)
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)
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... (2 Replies)
Hi All
I need a script to manipulate files based on a filename:
example filename: 66600_042706.pdf
the script will create a directory 66000 only if this directory is not existing. If that directory is existing it will just move the file to 66000/666000_042706.pdf
in addition, i want to... (4 Replies)
I know this gets covered quite a bit in the forum and I think there is enough there for me to figure out how to do what I am trying to do, I just don't think I would do it very efficiently so I am going to ask the question...
I have database log files with date and time stamps in the file like
... (7 Replies)
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)
Move all files starting with a specific name to different directory.
This shell script program should have three parameters
File Name
Source Directory
Destination Directory
User should be able to enter ‘AB_CD*' in file name parameter. In this case all the files starting with AB_CD will... (1 Reply)
Hello all,
I'm very new to shell scripting and need quite urgently to do this thing for my student job. I have a directory called "vectors" with a bunch of files all named ".vector". also i have for each of those files a directory with the name . I now want to move each of those *.vector files... (2 Replies)
Discussion started by: sherresh
2 Replies
LEARN ABOUT MOJAVE
dirname
DIRNAME(3) BSD Library Functions Manual DIRNAME(3)NAME
dirname -- extract the directory part of a pathname
SYNOPSIS
#include <libgen.h>
char *
dirname(char *path);
char *
dirname_r(const char *path, char *dname);
DESCRIPTION
The dirname() function is the converse of basename(3); it returns a pointer to the parent directory of the pathname pointed to by path. Any
trailing '/' characters are not counted as part of the directory name. If path is a null pointer, the empty string, or contains no '/' char-
acters, dirname() returns a pointer to the string ".", signifying the current directory.
IMPLEMENTATION NOTES
The dirname() function returns a pointer to internal storage space allocated on the first call that will be overwritten by subsequent calls.
dirname_r() is therefore preferred for threaded applications.
Other vendor implementations of dirname() may modify the contents of the string passed to dirname(); if portability is desired, this should
be taken into account when writing code which calls this function.
LEGACY SYNOPSIS
#include <libgen.h>
char *
dirname(const char *path);
In legacy mode, path will not be changed.
RETURN VALUES
On successful completion, dirname() returns a pointer to the parent directory of path.
If dirname() fails, a null pointer is returned and the global variable errno is set to indicate the error.
ERRORS
The following error codes may be set in errno:
[ENAMETOOLONG] The path component to be returned was larger than MAXPATHLEN.
[ENOMEM] The static buffer used for storing the path in dirname() could not be allocated.
SEE ALSO basename(1), dirname(1), basename(3), compat(5)STANDARDS
The dirname() function conforms to X/Open Portability Guide Issue 4, Version 2 (``XPG4.2'').
HISTORY
The dirname() function first appeared in OpenBSD 2.2 and FreeBSD 4.2. The dirname_r() function first appeared in OS X 10.12.
AUTHORS
Todd C. Miller
BSD October 12, 2006 BSD