Since this site solved my problems before, I am back for more (solutions)
I down load via a script every day a file that has the same name as the file of the day before. I want to move that file to its own directory like:
/archive/jul30
How do I capture the systems date in a script an... (2 Replies)
Hi,
How do you find the create date of a directory? I can see the modification date using ls -l but I'm looking for the create date.
Many thanks
Helen (2 Replies)
Hi,
After checking all the UNIX threads, I am able to come up with a solution so far. I am working on a shell script where it moves the files to a certain directory. The conditions to check are
1) Check if the file exists in the current directory.
2) Check if the destination directory... (2 Replies)
Hi, I have a question, is there any way I can, when i create a directory, put the current date on it so that the directory name will be "name-current date"? just curious (3 Replies)
I am preparing a shell script to backup a few config files on a daily basis, with a retention of 30 days. Need some help with syntax/examples:
The shell script (running as cron) would require the following:
1. create a sub-directory within a specified (backup) directory, in the format... (3 Replies)
Hi guys,
I had a scenario...
1. I had to get the previous days date in yyyymmdd format
2. i had to create a file with Date inthe format yyyymmdd.txt format
both are different
thanks guys in advance.. (4 Replies)
I have requirment to get last date of previous month and the first date of previous 4th month:
Example:
Current date: 20130320 (yyyymmdd)
Last date of previous month: 20130228 (yyyymmdd)
First date of previous 4th month: 20121101 (yyyymmdd)
In my shell --date, -d, -v switches are not... (3 Replies)
Hi All,
can any body tell me how to create a new directory with previous time stamp in HP-UX?.
e.g i am creating a file liketouch -t 07022013 kkk
-rw-r----- 1 feeds sys 0 Jul 2 20:13 kkksame how can i create a directory?
please help me.
Thanks & Regards,
Krupa (4 Replies)
Hi all,
i have a folder, with tons of files containing as following,
on /my/folder/jobs/
some_name_2016-01-17-22-38-58_some name_0_0.zip.done
some_name_2016-01-17-22-40-30_some name_0_0.zip.done
some_name_2016-01-17-22-48-50_some name_0_0.zip.done
and these can be lots of similar files,... (6 Replies)
I have a bash that downloads a list and if that list has data in it then a new main directory is created (with the date) with several subdirectories (example1, example2, example3). My question is in that list there are portion of specific file types (.vcf.gz) - identifier towards the end that have... (0 Replies)
Discussion started by: cmccabe
0 Replies
LEARN ABOUT DEBIAN
unparse_time_approx
PARSE_TIME(3) BSD Library Functions Manual PARSE_TIME(3)NAME
parse_time, print_time_table, unparse_time, unparse_time_approx, -- parse and unparse time intervals
LIBRARY
The roken library (libroken, -lroken)
SYNOPSIS
#include <parse_time.h>
int
parse_time(const char *timespec, const char *def_unit);
void
print_time_table(FILE *f);
size_t
unparse_time(int seconds, char *buf, size_t len);
size_t
unparse_time_approx(int seconds, char *buf, size_t len);
DESCRIPTION
The parse_time() function converts a the period of time specified in into a number of seconds. The timespec can be any number of <number
unit> pairs separated by comma and whitespace. The number can be negative. Number without explicit units are taken as being def_unit.
The unparse_time() and unparse_time_approx() does the opposite of parse_time(), that is they take a number of seconds and express that as
human readable string. unparse_time produces an exact time, while unparse_time_approx restricts the result to only include one units.
print_time_table() prints a descriptive list of available units on the passed file descriptor.
The possible units include:
second, s
minute, m
hour, h
day
week seven days
month 30 days
year 365 days
Units names can be arbitrarily abbreviated (as long as they are unique).
RETURN VALUES
parse_time() returns the number of seconds that represents the expression in timespec or -1 on error. unparse_time() and
unparse_time_approx() return the number of characters written to buf. if the return value is greater than or equal to the len argument, the
string was too short and some of the printed characters were discarded.
EXAMPLES
#include <stdio.h>
#include <parse_time.h>
int
main(int argc, char **argv)
{
int i;
int result;
char buf[128];
print_time_table(stdout);
for (i = 1; i < argc; i++) {
result = parse_time(argv[i], "second");
if(result == -1) {
fprintf(stderr, "%s: parse error
", argv[i]);
continue;
}
printf("--
");
printf("parse_time = %d
", result);
unparse_time(result, buf, sizeof(buf));
printf("unparse_time = %s
", buf);
unparse_time_approx(result, buf, sizeof(buf));
printf("unparse_time_approx = %s
", buf);
}
return 0;
}
$ ./a.out "1 minute 30 seconds" "90 s" "1 y -1 s"
1 year = 365 days
1 month = 30 days
1 week = 7 days
1 day = 24 hours
1 hour = 60 minutes
1 minute = 60 seconds
1 second
--
parse_time = 90
unparse_time = 1 minute 30 seconds
unparse_time_approx = 1 minute
--
parse_time = 90
unparse_time = 1 minute 30 seconds
unparse_time_approx = 1 minute
--
parse_time = 31535999
unparse_time = 12 months 4 days 23 hours 59 minutes 59 seconds
unparse_time_approx = 12 months
BUGS
Since parse_time() returns -1 on error there is no way to parse "minus one second". Currently "s" at the end of units is ignored. This is a
hack for English plural forms. If these functions are ever localised, this scheme will have to change.
HEIMDAL October 31, 2004 HEIMDAL