Programming :: Scheduled Copy Based On Filename?

Jun 17, 2010

Since I'm not building a specific piece of software but a shell script, I hope this is in the right forum. At work, we use RHEL for the basic system but have Windows clients attached as well. On the Win side, there's a program that I'm trying to duplicate on the Linux side. Because of established procedures, I can't change the way files are named so please don't suggest I do that (my boss would not be happy). We have files stored on an NFS share we manipulate on either side.

The program is used to copy files from one directory to another, based on the filenames. The first two characters of the filename are ignored (they're for human-readable sorting purposes only), the next four characters are the time, and then all characters after that are ignored. The time is read and the file gets copied at that time. (This was all done in VC++ many years ago, and nobody knows where the source code is.) For example, a file named 2d0730abcd.txt would be copied from the source directory to the destination directory at 7:30am.

It seems to me that it should be fairly straightforward to build a shell script on the Linux side to do the same thing, but darned if I can figure out which magical combination of commands to use. Would the shell script end up creating a giant pile of AT commands?

View 10 Replies


ADVERTISEMENT

Programming :: Moving Files To Directories Based On Part Of Filename?

Jul 6, 2010

I have a single directory of pairs of files, with the pairs sharing a string as the beginning of the filename:

SF1-27F1492R-clone01_T3_A18_001.ab1
SF1-27F1492R-clone01_T7_A20_002.ab1
SF1-27F1492R-clone02_T3_A19_003.ab1
SF1-27F1492R-clone02_T7_A21_004.ab1
...etc

I need to create a subdirectory for each pair then move the pair into the subdirectory.

I accomplished the first step using:

$find /foo -name '*T3*' -exec mkdir '{}.wrk' ;

I can use a regex to designate the pair and associate the directory, but how do I use regex in a path as the output of a move command?

View 7 Replies View Related

Programming :: Copy All The Files In The Directory Based On The Modification Date?

Dec 29, 2010

Originally Posted by Kenny_StrawnPlease wrap [CODE] tags aroung any code posted here. The full source that way could still be posted.I am trying to copy all the files in the directory based on the modification date (i.e created on Dec 29). Not able to find the proper command for this. This is what I have tried.

(none) login: root
#
# cd /mnt/hd/

[code]...

View 8 Replies View Related

Ubuntu :: Scheduled Copy Folder Task?

Jan 10, 2011

i was reading on how to do scheduled tasks, however i couldnt find anything that was a scheduled task to copy a whole folder to a NAS(Network Storage) thats linked on my ubuntu desktop every 4 hours or so.

View 1 Replies View Related

Ubuntu :: Sorting Files Based On Filename?

Nov 2, 2010

I'm currently trying to organize a media server so that things will be in some kind of logical order rather than the current setup of dumping everything of a certain content type into a single folder. However, the size and diversity of content within these disorganized folders precludes me doing things manually. Does anyone know of a program or script that could sort the files into folders based on part of a filename

View 7 Replies View Related

General :: Split A Directory Based On The Filename Prefix?

Mar 5, 2010

I have a very large directory with probably millions of small files in it. It's taking forever to run ls on the directory.

Is there an easy script that I can run to split the directory into smaller ones, based on the prefixes of the filenames. My goal is to wind up with something similar to what the Debian archives' pool directory looks like.

View 1 Replies View Related

General :: Processing Log File Within Certain Dates Based On Filename

Apr 8, 2010

I am working on the script parsing specific message "TEST" from multiple file. The log file name looks like:

N3.2009-11-26-03-05-02.console.log.tar.gz
N4.2009-11-29-00-25-03.console.log.tar.gz
N6.2009-12-01-10-05-02.console.log.tar.gz

I am using the following command:
zgrep -a --text "TEST" * | awk -F"[ .,]" '{sub(".*:","",$6); sub(",.*","",$7); print $1,$6,$7,$10}
and getting
N3 2009-11-25 20:12:57 TEST
N4 2009-11-28 10:42:18 TEST
N6 2009-12-01 10:00:24 TEST

If I only want to search the log file after 2009-11-29, what shall I change the command?

View 1 Replies View Related

General :: List Files Based On Matching Only Part Of Their Filename?

Sep 13, 2011

I have many files in a folder for example

Kiran.txt
Kiran1.txt
Kiran221.txt
Kiran144.txt
Time.csv

[Code]...

From this directory, I want to know how I could use grep to display files based on part of their filename - for example those starting with "Account" or those ending in ".sh".

View 4 Replies View Related

Programming :: Convert A Dynamic Library (filename.so) To A Static Library (filename.a)?

Nov 18, 2009

How can we convert a dynamic library (filename.so) to a static library (filename.a) using gnu gcc . Can we get a static library form a dynamic library . I saw a few post in which the conversion form a static library to a dynamic library is mentioned but, unfortunately, not the other way.

View 4 Replies View Related

Ubuntu :: Nautilus Script - Copy Just The Filename

Feb 7, 2011

I have found a Nautilus script that is able to copy the path of a file(e.g. /home/#&*@^/name_of_file.jpg) & I do use it regularly but I would also like to have a Nautilus script that would copy just the filename, not the path. Is there any Nautilus script out there that could do that?

View 1 Replies View Related

General :: Set A Pattern That Will Output A Filename Equal To The Original Filename In SoundConverter?

Jan 23, 2011

$ uname -a
Linux a 2.6.35.10-74.fc14.i686.PAE #1 SMP Thu Dec 23 16:10:47 UTC 2010 i686 i686 i386 GNU/Linux
$ lsb_release -a
LSB Version: :core-4.0-ia32:core-4.0-noarch

[Code].....

How can I set a pattern that will output a filename equal to the original filename? E.g.

something.mp3 → something.ogg

And why isn't this implemented in SoundConverter?

PS: {Filename} doesn't work.

View 1 Replies View Related

General :: Create A Script That Will Look For A "filename" Under /etc/, Date Stamp The File And Copy It To /var/www/upload?

Jul 14, 2011

I'm trying to create a script that will look for a "filename" under /etc/, date stamp the file and copy it to /var/www/upload

View 5 Replies View Related

General :: Shell - What's The Difference Between Filename And ./filename

Apr 23, 2010

What is the difference between filename and ./filename? Under what circumstances is one preferred to the other?

View 5 Replies View Related

Server :: Split A Filename Into Its Filename And Extension?

Apr 6, 2010

I need to split a filename into its filename and extension, so I can append a datestamp to the filename. I'm using bash.

View 8 Replies View Related

CentOS 5 Hardware :: How To Compile Filename.c Into Filename.o

Nov 20, 2009

I've installed ethernet adapter, it is made in china from a manufacturer called FOX. The driver for that adapter is supported for sco linux kernel version 2.4.x and 2.5.x .However, I'm using Centos5 but the OS didn't recognize the adapter alone, so I'm trying to follo instructions on the driver on the attached CD.

The CD contains file named "SC92031.c", the instructions tell me to do the following "Compile the driver source files and it will generate sc92031.o"

View 8 Replies View Related

Programming :: Bash Script And Filename Spaces ?

Jan 15, 2010

I have over 50 files names with spaces in them.

I'm trying to use a for loop as such:

However, when I print the $filename in the script, the script prints out parts of the filename because of the spaces in the file name.

For example, say the file name was Star Quest.php

When the script executes one $filename would be Star and another Quest.php.

How could I account for this? Something like $'filename'

View 13 Replies View Related

General :: Copy Text From Xterm Based Terminal To Some Other Gui Application?

Jan 13, 2011

i use uxrvt ( for those who dont know, its terminal emulator based on xterm).i know its easy to copy/paste stuff from terminal to itself is a trivial thing. it can be done by mouse left click to select and middle click to paste.but in my case i need to copy text from terminal to another application, viz on google chromium.

View 1 Replies View Related

Programming :: Bash - Test If First 2 Characters In A Filename Are Numbers?

Oct 21, 2010

I have a directory with files like this:

Code:

And what I'd like is to have the files renamed like this:

Code:

How could I code it so that it removes the numerical part of the filename (at the beginning), even with different patterns (like the 01 - artist vs the 01-artist)?

View 8 Replies View Related

Programming :: Delete All Files With Specific Word In Filename?

May 21, 2011

I need a command to find the all files which filename contains the text "SomeText" and to delete that files!From /home/movie/wp-content/uploads/this folder I have lots of files and folders .Also I need that for folders and subfolders who contains some text in folder name "someTextInFolderName"

View 13 Replies View Related

Programming :: Script To Insert Characters At End Of Basename In A Filename

Aug 19, 2010

Enterprise Linux 4 (2.6.9-78 kernel)...rename not working! Need to insert "_T" at the end of every file in a directory, just before the ".extension"

I have tried sed substitution with no success (because I do not know the codes and effects of anchoring well enough).

An example filename:

My failed tests:

Code:

Code:

Code:

Code:

View 9 Replies View Related

Debian Programming :: Using Perl To Replace Filename Strings In A Directory

Jun 12, 2013

I have a directory of orchestral music .ogg files from a family member. Each track is from a different artist and the CDDB entry adds a ":" character after the artist name in the track title.

Here is an example of what I am referring to:

Code: Select all13_-_Mozart:_Sonata_in_A_major_KV_331.ogg

I would like to parse file names in any given directory and search for the string Code: Select all: and replace it with Code: Select all_ According to this post on stackoverflow, I can use Perl to accomplish this task. I've tried Code: Select allperl -i.bak -pe 's/:/_/' but since I am still learning Perl I'm probably commiting a PEBKAC error.

How would I go about solving this issue with regular expressions using Perl?

View 3 Replies View Related

Programming :: Check That The Same File Exists Within Two Different Directories Using A Filename As A Variable?

Apr 30, 2010

I am in need of a way to check that the same file exists within two different directories using a filename as a variable. Here is the process which requires it: The script is reaches out (via ftp) and pulls down a file(s) and delete it afterwards. This is halfhazard because in the instance it doesnt pull down the file, yet still deletes it, we are up a creek. I am looking to pull it down to a temp location and then verify that file exists in the location in which it needs to be present to process before deleting it, adding a little extra layer for security. The script itself is finished.If I put a file name in manually it works perfect. I just need a way to pump the filename into the variable.

View 1 Replies View Related

Programming :: Bash - Rename Multiple Files With Dots In Filename

Oct 3, 2009

i have lots of files with dots insde file name for example:

document.1.is.bigger.doc
resume.version12.doc
10.photo.www.cnn.com.jpg

i want to rename all files in that directory to be the same (with same extention) but convert dots to underscore "_"

how can i do that on bash script / php.

View 6 Replies View Related

Programming :: Ext3 To FAT32 USB Drive Filename - Invalid Characters

Feb 13, 2011

I am using Debian Lenny 5.0.3 with a stock 2.6.26-2-amd64 kernel, and have a ~/Documents/HTMLS directory of 273.2MB (21590 files, 1063 sub-folders) which according to konqueror shows 1130 items - 572 files (60.8MB Total) - 558 folders, these were created by 'Save Page As' in Iceweasel 3.5.11. I am trying to copy the contents of this directory to a similar directory on a 2GB USB thumbdrive /dev/sdb1 which was partitioned and formatted as fat32 by Qparted. Problem is that the copying ceases after about 6 files transfer. I found that (as I am sure you know) the named.html files come with a matching named_files folder, and often there are what appear to be invalid characters such as '*','?',and ':' in the filenames in said named_files folders.

After exhaustive googling [I know we all say that] I found an instruction:
Code:
pax -rw -s '/[*?:]/_/gp' stuff /fat32/partition
that changes the name of the files, replacing said characters with '_', but whilst I can get pax from my repos, I really don't want to 'archive' the files - since I understand that pax was created to bridge a war between tar and cpio - because I want to be able to read the html files on an old (not connected to the Internet) WinXP tablet. So, I believe that I need to create a script, that scans all the filenames, greps and seds to replace said 'unacceptable' characters. I am assuming that Firefox on the Tablet PC will be able to open the htmls if I can get them onto the thumb drive. Are there any other known characters in filenames that M$ file systems can't handle?

View 1 Replies View Related

Software :: Difference Between <filename>.rpm And <filename>.src.rpm?

Nov 22, 2010

what is the difference between <filename>.rpm and <filename>.src.rpm?

View 2 Replies View Related

Programming :: Perl Beginner - Can't Get PerlMagick To Read Filename From Array Element?

Aug 21, 2010

it's been a while since I logged on here! I've been trying my hand at a little perl and have hit a brick wall.I'm using the Imagemagick module to manipulate some images. I can get the following to work without issue:

Code:
$teampath = "/var/www/team1";
$player=Image::Magick->new;

[code]...

View 1 Replies View Related

Programming :: Pipe Filename Ends On &quot;|&quot; With ARM-processor?

Apr 11, 2011

When issueing a "mkfifo /tmp/1"on my laptop(x86), I get this file:

Code: prw-r--r-- 1 root root 0 2011-04-11 15:09 1

If I issue the same command on a AT91SAM9260(arm), I get this file:

Code: prw-r--r-- 1 root root 0 Dec 31 17:00 1|

What could I be doing wrong, since I am getting a pipe "|" in the end of the filename?

View 2 Replies View Related

Programming :: Sed - Save Output To File With Filename From Content Of Another File?

Feb 28, 2011

My employer issues pdf files with everyones work schedules. I copy the content and save it as plain text in a file called unformatted (hope to be able to automate this step someday). Im working on a SED script that reduces unformatted to only display what I want to see and saves the result in a file Iïve named formatted. After that I have to manually copy formatted and save it with that days date as a filename e.g. 2011-02-25 or whatever day is scheduled in the pdf, for use on a mobile device (Nokia N900). I noticed that the date occurs on certain lines in the file so I added a line like:

sed -n 's/^Date: (201[1-9])/([0-1][0-9])/([0-3][0-9]).*/1-2-3/p' < unformatted >theDate
That creates a file theDate with the date in it that I wish to use as the filename for this particular instance. So I would like to skip the file formatted all together and have the sed- script write to a new file using the content of the Date as a filename, but how do I make that happen? And of course it would be more elegant if I could skip the intermediate theDate file as well.

View 4 Replies View Related

Programming :: Filtering Based On Columns?

Nov 13, 2010

Is there any way to filter the output of a command based on the values on the output columns. For example i execute du -h on directory with many files. Now I want to filter the output based on the size (i.e. M or G or K ). The filtered o/p should contain only M(megabytes) or G(gigabytes) and also all columns.

20K ./fload/temp/20000101/Pam
15K ./fload/temp/20000101/NAVEX
29K ./fload/temp/20000101/Avenge

[code]....

View 3 Replies View Related

Programming :: Non-GNU Based Getopts For Java?

Jul 29, 2010

I'm looking for a version of Getopts for Java that isn't licensed under the GPL and accepts long options (i.e. both -h and --help). My code is licensed under BSD and I don't really want to change that just because a module uses the GPL...

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved