Hi,
I have a problem.
I have some text files in a folder. The names can be like:
emp.txt
emp1.txt
emp3.txt
32emp4.txt
What i need is i have to copy all the files which have "emp" string in their filename
to a different folder and those file names... (7 Replies)
I would like to copy files from one directory to another directory while renaming them at the same time. Does anyone have any ideas on how to do this in a script?
Basically, would like to copy files from
/user/data/prod/*.txt
to
/user/data/bck/*.txt.bck (3 Replies)
Hi,
There is file generated automatically at /usr/files as fileYYYYMM(e.g file201005 and so on).
I need a script that will i)pick up the latest file from that path ii)rename the copied file to fileYYYYMM and then iii)copy to another server at path /usr/dest.If the file name with same name... (1 Reply)
Hi Geeks,
I am relatively new to Unix. Trying out to achive a shell script by hard learning. Here is my requirment.
1. I have to search for specified strings that are given in .csv file in the directory to find the files for matching strings in the .csv file.
2. If match is found, copy... (1 Reply)
Hey all!
Sorry for the noobish question..
I am wondering how to I copy multiple files, and rename them based on their directory at once.
So, I have files like this
/logs/server/2011-10/server-1/log/file/folder/some.log.gz
/logs/server/2011-10/server-2/log/file/folder/some.log.gz... (3 Replies)
hi,
source directory as /home/home01
target directort as /home/home02
I have below files in source directory:
FrontOf_history.dat
FrontOf_history1.dat
In target directory have many files as:
Kront_2014.dat
Kront_2015.dat
Kront_2016.dat
Now i want to copy the two files... (1 Reply)
Hi
I think this should be relatively simple but I can't figure it out. I have several files with the same name in different folders within a directory (the output of a program that I ran). Something like this:
./myAnalysis/item1/round1/myoutput.txt
./myAnalysis/item1/round2/myoutput.txt... (2 Replies)
Below is the script i have but i would like simplified but still do the same job.
I need a script to copy files not directories or sub-directories into a existing or new directory. The files, if have the same name but different extension; for example 01.doc 01.pdf then only copy the .doc file. ... (1 Reply)
Hi All,
I need to copy files from one directory to another with the files to be renamed while copying if a file with the same name already exists in the target directory.
THanks,
Dev (2 Replies)
Discussion started by: dev.devil.1983
2 Replies
LEARN ABOUT LINUX
fstatat
FSTATAT(2) Linux Programmer's Manual FSTATAT(2)NAME
fstatat - get file status relative to a directory file descriptor
SYNOPSIS
#include <fcntl.h> /* Definition of AT_* constants */
#include <sys/stat.h>
int fstatat(int dirfd, const char *pathname, struct stat *buf,
int flags);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
fstatat():
Since glibc 2.10:
_XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
Before glibc 2.10:
_ATFILE_SOURCE
DESCRIPTION
The fstatat() system call operates in exactly the same way as stat(2), except for the differences described in this manual page.
If the pathname given in pathname is relative, then it is interpreted relative to the directory referred to by the file descriptor dirfd
(rather than relative to the current working directory of the calling process, as is done by stat(2) for a relative pathname).
If pathname is relative and dirfd is the special value AT_FDCWD, then pathname is interpreted relative to the current working directory of
the calling process (like stat(2)).
If pathname is absolute, then dirfd is ignored.
flags can either be 0, or include the following flag:
AT_SYMLINK_NOFOLLOW
If pathname is a symbolic link, do not dereference it: instead return information about the link itself, like lstat(2). (By
default, fstatat() dereferences symbolic links, like stat(2).)
RETURN VALUE
On success, fstatat() returns 0. On error, -1 is returned and errno is set to indicate the error.
ERRORS
The same errors that occur for stat(2) can also occur for fstatat(). The following additional errors can occur for fstatat():
EBADF dirfd is not a valid file descriptor.
EINVAL Invalid flag specified in flags.
ENOTDIR
pathname is relative and dirfd is a file descriptor referring to a file other than a directory.
VERSIONS
fstatat() was added to Linux in kernel 2.6.16.
CONFORMING TO
POSIX.1-2008. A similar system call exists on Solaris.
NOTES
See openat(2) for an explanation of the need for fstatat().
SEE ALSO openat(2), stat(2), path_resolution(7), symlink(7)COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2009-12-13 FSTATAT(2)