Sponsored Content
Full Discussion: Script sortof half-working?
Top Forums Shell Programming and Scripting Script sortof half-working? Post 302288960 by hot_pants on Wednesday 18th of February 2009 11:50:34 AM
Old 02-18-2009
Script sortof half-working?

I have directories full of files that contain dates and times in their names in the format YYYYMMDDhhmm. So like, one of the files is named 199407271609 with no file extension.

I have this script searches a given directory and changes all creation dates of the files to match the date in their name:

Code:
#! /bin/zsh

for filename in `ls $1`
do
touch -t $filename $1/$filename;
done

The script changes the creation dates correctly, but the only problem is, it's ignoring the hours and minutes part and making all the creation times 12:00 AM. What am I missing here? Any help greatly appreciated.
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Internet half-broken

I have an odd problem with my internet connection. I think it's software not hardware, but I'm not even certain of that. My best guess is that it relates to my recent installation of KVpnc. I can't connect to most websites: no ping, nothing in the browser. But other websites I can connect to... (7 Replies)
Discussion started by: CRGreathouse
7 Replies

2. Programming

[C] Is there a way to clean half screen?

Hi, I wrote a program for Windows environment. It shows a menu to choice some operations to do. Once an operation is done, it cleans the screen with a system("cls") call, and the menu is shown again. I'd like to just clean half screen, so the program doesn't need to call again the print menu... (5 Replies)
Discussion started by: Luke Bonham
5 Replies

3. Shell Programming and Scripting

Script is not working from cron while working manually

Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

4. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

5. Solaris

Steps to reestablish SRDF which is half split

HI Guys, Can you please let me know the procedure to reestablish the SRDF which is half split, as you can see from the below O/P that one of the device is synchronized and other devices are in split mode Source (R1) View Target (R2) View MODES... (2 Replies)
Discussion started by: ravijanjanam12
2 Replies

6. UNIX for Dummies Questions & Answers

[SOLVED] Only half my script runs

Hello out there, I got this script that runs partly fine by my crontab. Problem is it gets to the sleep 300(which should be 5 minutes right?) part and never runs the rest of the scripts past that. All individual scripts run just fine. My var/mail file only shows it up to the " echo "Loader Stop... (3 Replies)
Discussion started by: vsekvsek
3 Replies

7. Ubuntu

How to creat a half-triangle in bash(Ubuntu)?

how to create a half-triangle like this and that will accept an input from the user, Dimension of the triangle will be based on the users input. example: enter the dimension: 5 ***** -**** --*** ---** ----* thankyou (3 Replies)
Discussion started by: carljoses
3 Replies

8. AIX

Half part of devices is in defined mode

I have an old p5 570 ibm server that consists of two enclosure and make by FC1847 cable, single 8 processors server. So, after one part of it, accidentally was turned off, I lost all devices from it. Now they all in defined mode, for example: dodo:/# lsdev -Cc processor proc0 Available 00-00... (8 Replies)
Discussion started by: mcgvaer
8 Replies
AR(1)							      General Commands Manual							     AR(1)

NAME
ar - archive and library maintainer SYNOPSIS
ar key [ posname ] afile [ file ... ] DESCRIPTION
Ar maintains groups of files combined into a single archive file, afile. The main use of ar is to create and update library files for the loaders 2l(1), etc. It can be used, though, for any similar purpose. Key is one character from the set drqtpmx, optionally concatenated with one or more of vuaibclo. The files are constituents of the archive afile. The meanings of the key characters are: d Delete files from the archive file. r Replace files in the archive file, or add them if missing. Optional modifiers are u Replace only files with modified dates later than that of the archive. a Place new files after posname in the archive rather than at the end. b or i Place new files before posname in the archive. q Quick. Append files to the end of the archive without checking for duplicates. Avoids quadratic behavior in t List a table of contents of the archive. If names are given, only those files are listed. p Print the named files in the archive. m Move the named files to the end or elsewhere, specified as with o Preserve the access and modification times of files extracted with the x command. x Extract the named files. If no names are given, all files in the archive are extracted. In neither case does x alter the archive file. v Verbose. Give a file-by-file description of the making of a new archive file from the old archive and the constituent files. With p, precede each file with a name. With t, give a long listing of all information about the files, somewhat like a listing by ls(1), showing mode uid/gid size date name c Create. Normally ar will create a new archive when afile does not exist, and give a warning. Option c discards any old contents and suppresses the warning. l Local. Normally ar places its temporary files in the directory /tmp. This option causes them to be placed in the local directory. When a d, r, or m key is specified and all members of the archive are valid object files for the same architecture, ar inserts a table of contents, required by the loaders, at the front of the library. The table of contents is rebuilt whenever the archive is modified, except when the q key is specified or when the table of contents is explicitly moved or deleted. EXAMPLE
ar cr lib.a *.o Replace the contents of library with the object files in the current directory. FILES
/tmp/v* temporaries SOURCE
/sys/src/cmd/ar.c SEE ALSO
2l(1), ar(6) BUGS
If the same file is mentioned twice in an argument list, it may be put in the archive twice. This command predates Plan 9 and makes some invalid assumptions, for instance that user id's are numeric. AR(1)
All times are GMT -4. The time now is 05:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy