Creating timestamped directories/files in expect


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Creating timestamped directories/files in expect
# 1  
Old 04-14-2011
Creating timestamped directories/files in expect

Hi,

I am looking for the syntax to provide a timestamped log_file in expect.

Basically I want the equivalent of:

/outputs/`date +%d%m%y`/session`date +%H%M`

But scripted in expect so it can be handed over to the logfile function.

I have tried playing around with the timestamp command but it doesn't appear to accept it when specifying it together with log_file.

Does anybody know what the correct syntax for this would be.

Kind regards and many thanks in advance,

K

---------- Post updated 14-04-11 at 12:31 PM ---------- Previous update was 13-04-11 at 05:02 PM ----------

Managed to get it working by predefining variables:

set date [timestamp -format %d%m%y]
set time [timestamp -format %H%M]
/outputs/$date/session$time

It appears that this cannot be predefined inline.
# 2  
Old 04-14-2011
I have done this with a trivial C program, piping the log stream stdin to stdout, putting a time stamp in front of the first character of each (not blank?) line. When C read()'s one byte at a time, it tends to force lowest latency. In ksh on /dev/fd/ systems and in bash, you can make the log file >(...), or you can manage a named pipe.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need BASH Script Help to Move Files While Creating Directories

I've got this script to loop through all folders and move files that are more than 2 years old. I'm using the install command because it creates the necessary directories on the destination path and then I remove the source. I'd like to change the script to use the mv command since it is much... (4 Replies)
Discussion started by: consultant
4 Replies

2. Shell Programming and Scripting

Archiving and moving files into directories, creating directories, etc.

how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex. so mydemo--2015-03-23-1500.tar.gz > database -... (5 Replies)
Discussion started by: wyclef
5 Replies

3. Shell Programming and Scripting

Using Expect and scp. Not moving directories

An Expect script using scp to copy directories is not moving the subdirectories as wanted. The directory structure is: computerA (user 'test') /home/test/parentDir/subdir1 /home/test/parentDir/subdir2 and I want them copied to computerB (user 'archive') /home/archive/subdir1... (1 Reply)
Discussion started by: nohj ordpl
1 Replies

4. Linux

Default user:group permissions while creating files and directories

Hi, I am working on setup a environment where only a specific user can upload the builds on htdocs of apache. Now i want that a specific user can copy the builds on htdocs folder. I created a group "deploy" and assign user1 and user2 to this group. On Apache side i mentioned User=deploy... (3 Replies)
Discussion started by: sunnysthakur
3 Replies

5. Shell Programming and Scripting

Copy files by automatically creating directories

I am in a situation where I have some hundreds of thousands of files in a directory (name of directory: big_directory). Now, working on this directory is extremely slow. I now plan to do this: Copy 1000 files in each of the directories by creating the directories automatically. All files have... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

6. Solaris

How to extract files from a tar file without creating the directories?

Hello all. I have a tar file that contains a number of files that are stored in different directories. If I extract this tar file with -xvf , the directories get created. Is there a way to extract all of the files into one directory without creating the directories stored in the tar file. (9 Replies)
Discussion started by: gkb
9 Replies

7. Shell Programming and Scripting

Copying a files from a filter list and creating their associated parent directories

Hello all, I'm trying to copy all files within a specified directory to another location based on a find filter of mtime -1 (Solaris OS). The issue that I'm having is that in the destination directory, I want to retain the source directory structure while copying over only the files that have... (4 Replies)
Discussion started by: hunter55
4 Replies

8. Shell Programming and Scripting

help needed with creating challenging bash script with creating directories

Hi, Can someone help me with creating a bash shell script. I need to create a script that gets a positive number n as an argument. The script must create n directories in the current directory with names like map_1, map_2 etcetera. Each directory must be contained within its predecessor. So... (7 Replies)
Discussion started by: I-1
7 Replies

9. Shell Programming and Scripting

Bash and Awk for creating directories and moving files

I have a security system that FTPs the camera files to my machine, however I want to sort the pictures (taken every 30s) into directories by hour. Every picture uses the following file format. yymmddhhmmsstt.jpg (where tt is the milliseconds) I am thinking the for loop is best for file... (11 Replies)
Discussion started by: Kiint
11 Replies

10. UNIX for Dummies Questions & Answers

Best approach for a 10 min extract out of several log files with timestamped records

I have a task where I need to code a shell script to extract a 10 min range (10 min from now until now) extract of a log file. I taught I could simply use a command that would say something like Start=date - 10 min but I didn't find anything. Looks like the only solution would have to code a... (3 Replies)
Discussion started by: Browser_ice
3 Replies
Login or Register to Ask a Question