Sponsored Content
Top Forums Shell Programming and Scripting Bash folder manipulation - selecting/copying specified files Post 302426348 by WildGooseChased on Tuesday 1st of June 2010 02:59:58 PM
Old 06-01-2010
Here's the ls -l output for 10 files over 6 days. I'm just interested in the timestamp in the filename, which doesn't correspond much if at all to the file modification date. So I guess I need to figure out some way of parsing out the date (ie, 2009-01-01) and the time (ie, 12-09-44-58) and comparing them - and I think I have examples of how to do that in other scripting languages (R & perl). But I'm still not sure how to go from the output of something like that back to telling the file system which actual file to copy to a different directory.

Quote:
-rwxrwxrwx 1 root root 67007 2009-01-01 12:21 bartlett_2009-01-01_12-09-44-58.jpg
-rwxrwxrwx 1 root root 71627 2009-01-02 12:06 bartlett_2009-01-02_12-00-31-84.jpg
-rwxrwxrwx 1 root root 70099 2009-01-02 12:21 bartlett_2009-01-02_12-10-31-71.jpg
-rwxrwxrwx 1 root root 60966 2009-01-03 12:21 bartlett_2009-01-02_12-15-33-89.jpg
-rwxrwxrwx 1 root root 75890 2009-01-04 12:06 bartlett_2009-01-03_12-00-35-25.jpg
-rwxrwxrwx 1 root root 76765 2009-01-04 12:21 bartlett_2009-01-03_12-10-35-13.jpg
-rwxrwxrwx 1 root root 73274 2009-01-05 12:21 bartlett_2009-01-04_12-10-34-02.jpg
-rwxrwxrwx 1 root root 76386 2009-01-06 12:06 bartlett_2009-01-05_12-00-35-73.jpg
-rwxrwxrwx 1 root root 78089 2009-01-06 12:21 bartlett_2009-01-05_12-10-35-59.jpg
-rwxrwxrwx 1 root root 41768 2009-01-07 12:21 bartlett_2009-01-06_12-10-37-98.jpg
Thanks!
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script for Finding files in a folder and copying to another folder

Hi all, I have a folder '/samplefolder' in which i have some files like data0.txt, data1.txt and data2.txt. I have to search the folder for existence of the file data0.txt first and if found have to copy it to some other file; next i have to search the folder for existence of file... (5 Replies)
Discussion started by: satish2712
5 Replies

2. Shell Programming and Scripting

bash script for selecting grib files with cdo

hi, i am new with scripts and have a little problem. i have a file with dates in the form YYYYMMDD, in average about 40 days per year. now i shall cut those days with cdo selday from monthly files. the script shall look up the days, forward them to the cdo operator and write the new grib... (1 Reply)
Discussion started by: jumkae
1 Replies

3. OS X (Apple)

Automated command ; extracting files from folders and copying them into a single folder

Hello everyone, I'm running Mac OS X Leopard (10.5.8) and I want to use the Terminal to help automate this tedious and laborious command for me: I need to extract all of the .m4p files in my "iTunes Music" folder which reside in folders of the artist, and then subfolders for the albums and... (2 Replies)
Discussion started by: qcom
2 Replies

4. Shell Programming and Scripting

copying random Jpg files to different folder

Hi, I have 200 pictures in a folder and I would like move 10 random pictures every week to given folder automatically. I have this server on 1and1.com. So I tried the following using Bash script for manual copy and paste for testing #!/bin/bash mapfile -t -n 3 files < <(find... (13 Replies)
Discussion started by: raamkum
13 Replies

5. Programming

Selecting files in regular intervals from a folder

Hi, I need your expertise in selecting files from a folder. I have files named with convention: filename.i.j where j is an interger from 1 to 16, for each i which is an integer from 1 to 2000. I would like to select the files with i in regular interval of 50 like filename.1.j,... (2 Replies)
Discussion started by: rpd25
2 Replies

6. Shell Programming and Scripting

Copying large files in a bash script stops execution

Hello, I'm new to this forum and like to first of all say hello to everyone. I've got a really annoying problem at the moment. I'm trying to rsync some files (about 200MB with one file of 120MB) from a Raspberry PI with raspbian to a debian server via rsync. This procedure is stored in a... (3 Replies)
Discussion started by: wex_storm
3 Replies

7. Shell Programming and Scripting

Copying files from various folders to similar folder structure in another location

Hi, I need to write a script the has to copy the files from folders and subfolders to the same folder structure located in another location. Ex: mainfolder1 file1,file2,file3 subfolder1(file1,etc) subfolder2(file1,etc) to another folder location of same folder structure. rsync is not... (7 Replies)
Discussion started by: Raji Perumal
7 Replies

8. Shell Programming and Scripting

Need help in finding and copying list of files using bash shell script

Dear All, I have a situation where I want to copy some files of type .txt. These files are o/p from one program. Some of the files are named as fileName .txt instead of fileName.txt after fileName by mistake I have specified "space". Now I want to move these files as follows. mv fileName*... (13 Replies)
Discussion started by: linuxUser_
13 Replies

9. Shell Programming and Scripting

Bash: copying lines with specific character to files with same name as copied line.

I am trying to make my script as simple as a possible but, I am not sure if the way I am approaching is necessarily the most efficient or effective it can be. What I am mainly trying to fix is a for loop to remove a string from the specified files and within this loop I am trying to copy the lines... (2 Replies)
Discussion started by: Allie_gastrator
2 Replies
SYSTEMD-VOLATILE-ROOT.SERVICE(8)                           systemd-volatile-root.service                          SYSTEMD-VOLATILE-ROOT.SERVICE(8)

NAME
systemd-volatile-root.service, systemd-volatile-root - Make the root file system volatile SYNOPSIS
systemd-volatile-root.service /lib/systemd/systemd-volatile-root DESCRIPTION
systemd-volatile-root.service is a service that replaces the root directory with a volatile memory file system ("tmpfs"), mounting the original (non-volatile) /usr inside it read-only. This way, vendor data from /usr is available as usual, but all configuration data in /etc, all state data in /var and all other resources stored directly under the root directory are reset on boot and lost at shutdown, enabling fully stateless systems. This service is only enabled if full volatile mode is selected, for example by specifying "systemd.volatile=yes" on the kernel command line. This service runs only in the initial RAM disk ("initrd"), before the system transitions to the host's root directory. Note that this service is not used if "systemd.volatile=state" is used, as in that mode the root directory is non-volatile. SEE ALSO
systemd(1), systemd-fstab-generator(8), kernel-command-line(7) systemd 237 SYSTEMD-VOLATILE-ROOT.SERVICE(8)
All times are GMT -4. The time now is 01:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy