Sponsored Content
Top Forums Shell Programming and Scripting Adding date and time to file name Post 302471738 by michaelrozar17 on Monday 15th of November 2010 01:26:15 AM
Old 11-15-2010
You could use (assuming this shell script is at the path where you need to add the date and time )
Code:
for i in *

or to be more precise
Code:
for i in *.*

As the former one would change the name of the sub-directory if its present in the current working dir.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Processing a log file based on date/time input and the date/time on the log file

Hi, I'm trying to accomplish the following and would like some suggestions or possible bash script examples that may work I have a directory that has a list of log files that's periodically dumped from a script that is crontab that are rotated 4 generations. There will be a time stamp that is... (4 Replies)
Discussion started by: primp
4 Replies

2. Shell Programming and Scripting

problem with displaying date and adding time

Hi, I have a log file with contents like 81.49.74.131 - - 81.49.74.131 - - 116.112.52.31 - - 116.112.52.31 - - I need an output like this 81.49.74.131 14/Sep/2008 Time duration: 00:06:00 116.112.52.31 15/Sep/2008 Time duration: 00:00:01 Please anyone suggest a script for this.... (1 Reply)
Discussion started by: FuncMx
1 Replies

3. UNIX for Dummies Questions & Answers

Adding date and time to a log file

Morning all Im hoping you can help me. We have a nice new oracle server :( and are needing to move some files around for EDI and BACS. The server runs windows but has an app called MKS toolkit installed which give unix commands. (Needed for the oracle stuff) I have had a go using dos commands... (2 Replies)
Discussion started by: ltodd2
2 Replies

4. UNIX for Dummies Questions & Answers

adding date to a file during FTP

I have a very basic question here. I have to FTP a file from a AIX unix box to a windows server. But during that I have to rename the file. For example: I have to FTP a file called ORDER.TXT from unix and it should go as ORDER_20090101.TXT on to the windows server. It is not possible to... (5 Replies)
Discussion started by: vara32
5 Replies

5. UNIX for Dummies Questions & Answers

Adding Date & time stamps to filename

I need to edit the file name with date and time while writing the script. please help. (1 Reply)
Discussion started by: manish.s
1 Replies

6. Shell Programming and Scripting

adding a date to the last of each file name

i have some files in my directory....wit names say aaa, bbb, ccc,,,,, i want to make loop so that for each file name,,,,,,a sysdate should be appended in the end.........and the files should look like aaa_20100331 i knw date can be appended as `date +"%Y%m%d"` but m nt able to make a loop. ... (2 Replies)
Discussion started by: amitpta
2 Replies

7. UNIX for Dummies Questions & Answers

[Solved] Adding time stamp to file name

I have the awk awk -F\* '$1=="ST",$1=="SE"{if($1=="ST"){close(f);f="sample" ++i} ; $1=$1; print>f}' OFS=\| <filename> How to add the time stamp to the file name mentioned as "sample" Please view this code tag video for how to use code tags when posting code and data. (6 Replies)
Discussion started by: atlantis_yy
6 Replies

8. UNIX for Dummies Questions & Answers

Adding hours and minutes to current date (Only to date not to time)

Hi, I want to add some hours and minutes to the current date. For example, if the current date is "July 16, 2012 15:20", i want to add 5 hours 30 minutes to "July 16, 2012 00:00" not to "July 16, 2012 15:20". Please help. Thanks! (4 Replies)
Discussion started by: manojgarg
4 Replies

9. Shell Programming and Scripting

Adding date to file

I want this: 0.0230769,0.407692,0.307692,0,0.1,1.4,1,0,ADD DATE HERE, im getting this: 11/02/12 0.00192308,0.0269231,0.0192308,0,0.1,1.4,1,0, my script: #!/bin/ksh DIR=/export/home/yani_m/scripts/scrip_out_put/ DIR2=/export/home/yani_m/scripts/scrip_out_put/calc/ Date=$1... (1 Reply)
Discussion started by: LucyYani
1 Replies

10. Shell Programming and Scripting

Adding time to date time in UNIX shell scipting

I needed some help in adding a duration (in seconds) to a start time (in hhmmss format) and a start date (in mmddyy format) in order to get an end date and end time. The concept of a leap year is also to be considered while incrementing the day. The code/ function that I have formed so far is as... (3 Replies)
Discussion started by: codehelp04
3 Replies
GIT-RM(1)							    Git Manual								 GIT-RM(1)

NAME
git-rm - Remove files from the working tree and from the index SYNOPSIS
git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <file>... DESCRIPTION
Remove files from the index, or from the working tree and the index. git rm will not remove a file from just your working directory. (There is no option to remove a file only from the working tree and yet keep it in the index; use /bin/rm if you want to do that.) The files being removed have to be identical to the tip of the branch, and no updates to their contents can be staged in the index, though that default behavior can be overridden with the -f option. When --cached is given, the staged content has to match either the tip of the branch or the file on disk, allowing the file to be removed from just the index. OPTIONS
<file>... Files to remove. Fileglobs (e.g. *.c) can be given to remove all matching files. If you want git to expand file glob characters, you may need to shell-escape them. A leading directory name (e.g. dir to remove dir/file1 and dir/file2) can be given to remove all files in the directory, and recursively all sub-directories, but this requires the -r option to be explicitly given. -f, --force Override the up-to-date check. -n, --dry-run Don't actually remove any file(s). Instead, just show if they exist in the index and would otherwise be removed by the command. -r Allow recursive removal when a leading directory name is given. -- This option can be used to separate command-line options from the list of files, (useful when filenames might be mistaken for command-line options). --cached Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone. --ignore-unmatch Exit with a zero status even if no files matched. -q, --quiet git rm normally outputs one line (in the form of an rm command) for each file removed. This option suppresses that output. DISCUSSION
The <file> list given to the command can be exact pathnames, file glob patterns, or leading directory names. The command removes only the paths that are known to git. Giving the name of a file that you have not told git about does not remove that file. File globbing matches across directory boundaries. Thus, given two directories d and d2, there is a difference between using git rm 'd*' and git rm 'd/*', as the former will also remove all of directory d2. REMOVING FILES THAT HAVE DISAPPEARED FROM THE FILESYSTEM
There is no option for git rm to remove from the index only the paths that have disappeared from the filesystem. However, depending on the use case, there are several ways that can be done. Using "git commit -a" If you intend that your next commit should record all modifications of tracked files in the working tree and record all removals of files that have been removed from the working tree with rm (as opposed to git rm), use git commit -a, as it will automatically notice and record all removals. You can also have a similar effect without committing by using git add -u. Using "git add -A" When accepting a new code drop for a vendor branch, you probably want to record both the removal of paths and additions of new paths as well as modifications of existing paths. Typically you would first remove all tracked files from the working tree using this command: git ls-files -z | xargs -0 rm -f and then untar the new code in the working tree. Alternately you could rsync the changes into the working tree. After that, the easiest way to record all removals, additions, and modifications in the working tree is: git add -A See git-add(1). Other ways If all you really want to do is to remove from the index the files that are no longer present in the working tree (perhaps because your working tree is dirty so that you cannot use git commit -a), use the following command: git diff --name-only --diff-filter=D -z | xargs -0 git rm --cached EXAMPLES
git rm Documentation/*.txt Removes all *.txt files from the index that are under the Documentation directory and any of its subdirectories. Note that the asterisk * is quoted from the shell in this example; this lets git, and not the shell, expand the pathnames of files and subdirectories under the Documentation/ directory. git rm -f git-*.sh Because this example lets the shell expand the asterisk (i.e. you are listing the files explicitly), it does not remove subdir/git-foo.sh. SEE ALSO
git-add(1) GIT
Part of the git(1) suite Git 1.7.10.4 11/24/2012 GIT-RM(1)
All times are GMT -4. The time now is 05:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy