As you can see, find will also print the path to the file in the output. To "solve" this, you can use the -printf option, but there is a problem, depending on your OS, this option will not be available:
Code:
# -printf arguments
# %h -> Path to the file
# %f -> Filename
find . \! -name "*.*" -type f -printf "cp %h/%f ${TO}/%f.txt\n" | sh
Last edited by felipe.vinturin; 10-27-2011 at 02:20 PM..
Hi
I am writing a script which does an FTP of a set of files onto another machine and then would have to rename the files into a different extension on the source machine.
for example if the file being sent via FTP is sample.txt. Once the file has been transferred i would want to modify the... (2 Replies)
Can anyone tell me the easiest way to append an extension (ie. .ldr) to all files in a directory that do NOT have an extension? The directory contains files with and without extensions, however I'm only interested in the files with NO extension.
Thanks. (3 Replies)
Hi,
I need a help regarding a small requirement. I have a list of C files. I need to put them in a file but without .c extension.
say if I have the files as file01.c, file02.c, file03.c etc
My file say cfiles should have
file01
file02
file03
...
...
etc
Appreciate your quick help on... (3 Replies)
Hi,
I have a root directory which has a big number of other subdirectories and contains a big number of files. I want to copy all these files and directories to another folder except files with certain extension, say .txt, files - how may I do this?
Thanks,
faizlo (8 Replies)
I am currently scanning a directory with a shell script to look for all files with a .sh extension. I am wondering how to make it look for more then one extension. For example all .sh, .conf, and .sql files?
Currently this is what I am doing....
find... (3 Replies)
I have a file
n06-z30-sr65-rgdt0p25-varp0.25-8x6drw-test.cmod
and I want to get the extension.
At the moment I have
set filextension = `echo $f | awk 'BEGIN {FS="."} {print $2}'`
which of course does not work as there is a point in varp0.25 (13 Replies)
Hi,
I am using scp to copy a certain directory over the network. This folder contain some files that I am not interested in. My question is; is it possible to copy files of certain extension only, keeping the same directory hierarchy as it is (that is sub-folders)?
Thanks (8 Replies)
Hi All,
I want to fetch the files based on .done file and display the .csv files and Wil take .csv files for processing.
1.I need to display the .done files from the directory.
2.next i need to search for the .Csv files based on .done file.then move .csv files for the one directory
... (2 Replies)
Hi,
I have multiple files that read:
Asa.txt
Bad.txt
Gnu.txt
And I want to rename them using awk to
Asa_ddmmyytt.txt and so on
...
If there is a single command or more efficient executable please share!
Thanks! (4 Replies)
Discussion started by: Jesshelle David
4 Replies
LEARN ABOUT CENTOS
funflush
funflush(3) SAORD Documentation funflush(3)NAME
FunFlush - flush data to output file
SYNOPSIS
#include <funtools.h>
void FunFlush(Fun fun, char *plist)
DESCRIPTION
The FunFlush routine will flush data to a FITS output file. In particular, it can be called after all rows have been written (using the
FunTableRowPut() routine) in order to add the null padding that is required to complete a FITS block. It also should be called after com-
pletely writing an image using FunImagePut() or after writing the final row of an image using FunTableRowPut().
The plist (i.e., parameter list) argument is a string containing one or more comma-delimited keyword=value parameters. If the plist string
contains the parameter "copy=remainder" and the file was opened with a reference file, which, in turn, was opened for extension copying
(i.e. the input FunOpen() mode also was "c" or "C"), then FunFlush also will copy the remainder of the FITS extensions from the input ref-
erence file to the output file. This normally would be done only at the end of processing.
Note that FunFlush() is called with "copy=remainder" in the mode string by FunClose(). This means that if you close the output file before
the reference input file, it is not necessary to call FunFlush() explicitly, unless you are writing more than one extension. See the
evmerge example code. However, it is safe to call FunFlush() more than once without fear of re-writing either the padding or the copied
extensions.
In addition, if FunFlush() is called on an output file with the plist set to "copy=reference" and if the file was opened with a reference
file, the reference extension is written to the output file. This mechanism provides a simple way to copy input extensions to an output
file without processing the former. For example, in the code fragment below, an input extension is set to be the reference file for a
newly opened output extension. If that reference extension is not a binary table, it is written to the output file:
/* process each input extension in turn */
for(ext=0; ;ext++){
/* get new extension name */
sprintf(tbuf, "%s[%d]", argv[1], ext);
/* open input extension -- if we cannot open it, we are done */
if( !(ifun=FunOpen(tbuf, "r", NULL)) )
break;
/* make the new extension the reference handle for the output file */
FunInfoPut(ofun, FUN_IFUN, &ifun, 0);
/* if its not a binary table, just write it out */
if( !(s=FunParamGets(ifun, "XTENSION", 0, NULL, &got)) ||
strcmp(s, "BINTABLE")){
if( s ) free(s);
FunFlush(ofun, "copy=reference");
FunClose(ifun);
continue;
}
else{
/* process binary table */
....
}
}
SEE ALSO
See funtools(7) for a list of Funtools help pages
version 1.4.2 January 2, 2008 funflush(3)