I have many images captured from my webcam and their name are: 2021-03-29_06-00 2021-03-29_06-02 2021-03-29_06-04 2021-03-29_06-06  2021-03-29_07-00  2021-03-29_08-00  2021-03-29_09-00 etc..  I want to delete images shooted by night. I found script to obtain sunrise (and sunset) times, now I have to filter my files and delete. I start to try with ls command. If I use: ls *_{00..06}*.jpg   the result is correct. By if I insert a variable with the time of sunrise, encounter of problems. SUNRISE=&quot;06&quot; ls *_{00..$SUNRISE}*.jpg   But the result are: ls: cannot access '*_{00..06}.jpg': File or directory does not exist
76806
Below is some sort of pseudo-code for what I'm trying to accomplish:  #!/bin/bash  # I already have the variable below figured out (positive integer): numlines=$([returns number of lines containing specific characters in a file])  # This is basically what I want to do with it: for i in {1..$numlines}; do     # the part below is already figured out as well:             do some other stuff done   I can execute it fine from the command line by inserting the actual number in the `{1..n}' sequence.  I just need to know if it's possible to include a variable here and how to go about doing it.   I have tried exporting it I have tried putting the variable itself in curly braces inside the sequence: {1..${numlines}} I have tried putting it in double-quotes hoping it would expand: {1.."$numlines"} I have tried escaping the $: {1..\$numlines}   Do I need to use a set -[something] command in order for this variable to get expanded?  I have even tried some forms of using eval...all to no avail.  I just need to know if there is something simple or obscure that I am missing or if this is even possible before I waste anymore time on it.  I could throw together a really, really hackish way of doing it to make it work as needed, but I'd like to avoid that if at all possible and learn the right way to go about doing it.
117657
I want to query start of day and end of day field from the user object but I am getting error for that refer images for more details
87785
I have a web server where I have run out of space and it's causing issues with the  sites I am running on them.  I know that I have a lot of large .png files (the fact that it's  is a mistake in itself, but let's not get into that).  I would like to get the list of PNG or  files that are on the server and sort them by decreasing size. I know I can use ls -SlahR, but the sorting is on a per-folder basis.  I then came up with find . -name "*.png" | xargs -i -n1 ls -lah {} which is OK except that (a) it doesn't sort the lines and (b) it shows the file permissions and ownerships which I couldn't care less about.  So is there something better? Something that would produce [size] [path_to_file]?
16442
I would like to write a small program in C# which goes through my jpeg photos and, for example, sorts them into dated folders (using MY dating conventions, dammit...).   Does anyone know a relatively easy way to get at the EXIF data such as Date And Time or Exposure programatically? Thanks!
56248
I have a script that deletes files 7 days or older and then logs them to a folder. It logs and deletes everything correctly but when I open up the log file for viewing, its very sloppy.  log=$HOME/Deleted/$(date)  find $HOME/OldLogFiles/ -type f -mtime +7 -delete -print &gt; "$log"   The log file is difficult to read  Example File Output: (when opened in notepad)  /home/u0146121/OldLogFiles/file1.txt/home/u0146121/OldLogFiles/file2.txt/home/u0146121/OldLogFiles/file3.txt   Is there anyway to log the file nicer and cleaner? Maybe with the Filename, date deleted, and how old it was?  Any suggestions help!
66866
I am trying to put together a Powershell script that will:  -Search recursively from a root directory -Exclude files with existing "yyyyMMdd " file name prefix -Rename the files not excluded above with ""yyyyMMdd " file name prefix based on their specific LastWriteTime  Note: ideally, this script should include all file type extensions  I have tried myself, but it would seem to be above my head, as my attempts are not going well.  Thanks, in advance.    #StampMe.ps1 param( [string] $fileName)  # Check the file exists if (-not(Test-Path $fileName)) {break}  # Display the original name "Original filename: $fileName"  $fileObj = get-item $fileName  # Get the date $DateStamp = get-date -uformat "%Y-%m-%d@%H-%M-%S"  $extOnly = $fileObj.extension  if ($extOnly.length -eq 0) {    $nameOnly = $fileObj.Name    rename-item "$fileObj" "$nameOnly-$DateStamp"    } else {    $nameOnly = $fileObj.Name.Replace( $fileObj.Extension,'')    rename-item "$fileName" "$nameOnly-$DateStamp$extOnly"    }  # Display the new name "New filename: $nameOnly-$DateStamp$extOnly"   I am hoping to change the line:  $DateStamp = get-date -uformat "%Y-%m-%d@%H-%M-%S"   To be LastWriteTime instead of get-date, but I have no idea how to make this happen.  This code (from another Super User question):  Get-ChildItem "Test.pdf" | Rename-Item -newname {$_.LastWriteTime.toString("yyyyMMdd") + " Test.pdf"}   ...successfully renames a single file, but I can't seem to integrate this into the larger script.    With regards to running the above recursively, I have tried this (also from ):  foreach ($file in get-ChildItem *.* -recurse) { ./StampMe.ps1 $file.name }   Which succeeds to apply the PS script to files in the root directory, but fails to apply to any files in the sub-folder tree that propagates from the root directory.
43071
Is there a command to delete all the files in a directory that haven't been modified in N days?  I need to clean up some old logs.
39164
I'm trying to keep a directory full of log files manageable. Nightly, I want to delete all but the 10 most recent. How can I do this in a single command?
31213
I am looking for a way to delete all files older than 7 days in a batch file.  I've searched around the web, and found some examples with hundreds of lines of code, and others that required installing extra command line utilities to accomplish the task.  Similar things can be  in just a couple lines of code. It seems that something at least remotely easy could be done for batch files in Windows. I'm looking for a solution that works in a standard Windows command prompt, without any extra utilities. Please no PowerShell or Cygwin either.
16435
I was wondering if anyone knows how to change the timestamps of folders recursively based on the latest timestamp found of the files in that folder.  So for example:   jon@UbuntuPanther:/media/media/MP3s/Foo Fighters/(1997-05-20) The Colour and The Shape$ ls -alF total 55220 drwxr-xr-x  2 jon jon    4096 2010-08-30 12:34 ./ drwxr-xr-x 11 jon jon    4096 2010-08-30 12:34 ../ -rw-r--r--  1 jon jon 1694044 2010-04-18 00:51 Foo Fighters - Doll.mp3 -rw-r--r--  1 jon jon 3151170 2010-04-18 00:51 Foo Fighters - Enough Space.mp3 -rw-r--r--  1 jon jon 5004289 2010-04-18 00:52 Foo Fighters - Everlong.mp3 -rw-r--r--  1 jon jon 5803125 2010-04-18 00:51 Foo Fighters - February Stars.mp3 -rw-r--r--  1 jon jon 4994903 2010-04-18 00:51 Foo Fighters - Hey, Johnny Park!.mp3 -rw-r--r--  1 jon jon 4649556 2010-04-18 00:52 Foo Fighters - Monkey Wrench.mp3 -rw-r--r--  1 jon jon 5216923 2010-04-18 00:51 Foo Fighters - My Hero.mp3 -rw-r--r--  1 jon jon 4294291 2010-04-18 00:52 Foo Fighters - My Poor Brain.mp3 -rw-r--r--  1 jon jon 6778011 2010-04-18 00:52 Foo Fighters - New Way Home.mp3 -rw-r--r--  1 jon jon 2956287 2010-04-18 00:51 Foo Fighters - See You.mp3 -rw-r--r--  1 jon jon 2730072 2010-04-18 00:51 Foo Fighters - Up in Arms.mp3 -rw-r--r--  1 jon jon 6086821 2010-04-18 00:51 Foo Fighters - Walking After You.mp3 -rw-r--r--  1 jon jon 3033660 2010-04-18 00:52 Foo Fighters - Wind Up.mp3   The folder "(1997-05-20) The Colour and The Shape" would have its timestamp set to 2010-04-18 00:52.
75644
I have 14,000 picture sorted into files by year and month but taken with multiple cameras. I want the file name to reflect the date the photo was taken.   For example, all pictures taken on October 16, 1998 are in a folder called 1998\10 October\19981016.   I want the all the pictures to be named 19981016_0001 19981016_0002 etc.   I can get to the point where it list the folder I want to change but I'm unable to actually change it. All of my pictures are .jpg.  I created a temp file of copies in case I messed it up. I started by typing:  cd "C:\Documents and Settings\Brooke LastName\Desktop\Temp"    then after successfully getting my file to load I used a formula I found on this forum.  ls *jpg | Foreach {$i=1} {Rename-Item _ -NewName ("$($.19981016){0:00000000#} .jpg" -f $i++) -whatif}   The error I got said  Unexpected token ' .19981016' in expression or statement.  At line:1 char:12 + $.19981016 &lt;&lt;&lt;&lt;   The error repeated several times  I found several formulas on the web but most created files that would number with parenthesis for example vacation (1).jpg I want a four digit counter after an underscore at the end of my date. ie 19981016_0001
16837
I've written a quick-and-dirty script to time some reports from a web service:  BASE_URL='http://example.com/json/webservice/' FIRST=1 FINAL=10000  for report_code in $(seq 1 $FINAL); do   (time -p response=$(curl --write-out %{http_code} --silent -O ${BASE_URL}/${report_code}) ) 2&gt; ${report_code}.time    echo $response  # &lt;------- this is out of scope!  How do I fix that?   if [[ $response = '404' ]]; then     echo "Deleting report # ${report_code}!"     rm ${report_code}   else     echo "${report_code} seems to be good!"   fi done   I need to wrap the time command in a subshell so I can redirect its output, but that makes the value of $response unavailable to the parent shell.  How do I get around this problem?
1270
For the purpose of testing, I'd like count how many images files are inside a directory, separating each image file type by file extension (jpg="yes". This because later it will be useful for another script that will execute an action on each file extension). Can I use something like the following for only JPEG files?  jpg="" count=`ls -1 *.jpg 2&gt;/dev/null | wc -l` if [ $count != 0 ] then echo jpg files found: $count ; jpg="yes" fi   Considering file extensions jpg, png, bmp, raw and others, should I use a while cycle to do this?
113653
I'm trying to set up a way for me to just type newjournal, and a new journal entry named year-month-date-time.txt is created in a year subdirectory in ~/documents/journals.   I've got it set up as an alias using the following:  alias newjournal='nano /home/username/documents/journals/'$(date +%Y)'/'$(date +%F-%k%M).txt''   So the year subfolder resolves correctly, and seemingly so does the first half of the date command. Tried appending the alias with sudo, didn't help.  Issue: For some reason, when I do this command the time value (%k) resolves to a few minutes ago... or maybe the last time nano ran this filename, maybe it's called an old buffer?   When I logoff it makes the correct file, then I save, wait a few minutes and try again, and it edits the old file instead of making a new one. Even if I remove the old file, it creates a new file with the old filename (incorrect time).  Here's a screenshot of what I'm trying to explain. Here I create a newjournal, save in nano within a second or two of executing the command, print the correct date/time, list the file that was created. Note the incorrect filename time (1249, as apposed to 13:11):    Anyways, it might be something simple, but I've tried different methods in the alias, such as putting double quotes around the whole thing and escaping properly, single quoting, escaping and spacing, etc.  Thanks for the read/help. Ubuntu 16.04 server.  EDIT: Here's the final alias that worked:  alias newjournal='nano /home/user/journals/"$(date +%Y)"/"$(date +%F-%H%M).txt"'   Needed to double quote the date commands inside the overall single-quoted alias.
122179
When I need to find my recently used files, this command:  ls -lt  lists in ascending order (by time), when there are lots files, I need to scroll to the top to see needed files, because won't fit in terminal screen.  After finding out that tac inverses the output, I use: ls -lt dir/ | tac Is there more fun way of doing it, without using external scripts/utils?
21020
I have 2000+ files in a folder, but there are few files missing from the folder.  Name of the files are like     GLDAS_NOAH025SUBP_3H.A2003001.0000.001.2015210044609.pss.grb   GLDAS_NOAH025SUBP_3H.A2003001.0600.001.2015210044609.pss.grb   GLDAS_NOAH025SUBP_3H.A2003001.1200.001.2015210044609.pss.grb   GLDAS_NOAH025SUBP_3H.A2003001.1800.001.2015210044609.pss.grb   GLDAS_NOAH025SUBP_3H.A2003002.0000.001.2015210044609.pss.grb   GLDAS_NOAH025SUBP_3H.A2003002.0600.001.2015210044609.pss.grb   GLDAS_NOAH025SUBP_3H.A2003002.1200.001.2015210044609.pss.grb   GLDAS_NOAH025SUBP_3H.A2003002.1800.001.2015210044609.pss.grb   GLDAS_NOAH025SUBP_3H.A2003003.0000.001.2015210044609.pss.grb   GLDAS_NOAH025SUBP_3H.A2003003.0600.001.2015210044609.pss.grb   GLDAS_NOAH025SUBP_3H.A2003003.1200.001.2015210044609.pss.grb   GLDAS_NOAH025SUBP_3H.A2003003.1800.001.2015210044609.pss.grb   001 indicates day, while 0000 is the hour.  How to find out which file is missing in the folder? I got few answer in google but could not figure out how to implement those.
12101
My early (Canon G2) photos are all JPG, but when I got my Nikon D90 I initially shot in JPG, then switched to RAW+JPG, and now I would like to switch to RAW only.  I have literally thousands of photos on my HDD.  The photos are in sub-directories (by date) under a single directory called Import.  I am about to import all these photos into Lightroom 3.0, however, I would like to delete all the JPG files, but only where there is already a corresponding RAW file (ie. I no longer want to keep JPG and RAW versions of the same file).  If I can do this easily within Lightroom (after importing everything, including the duplicate JPG files) that would be great.  It would also be OK if there were an easy way to do this before importing the files (but hopefully this wouldn't involve having to visit every directory looking for filenames with both JPG and NEF extensions).  Does anybody know of a way to do this (in Lightroom, or with some tool/script in Windows)?