Skip to main content
Be more explicit in the title about scripting requirements
Link
jubilatious1
  • 3.9k
  • 10
  • 21

How Use shell script to select a specific filepdf with unique filename format in shell scriptand recent creation-date?

improved question
Source Link

I am needing some help with a script. I'm currently trying to select PDF filesfile that meetmeets a specific requirement in the file name in order to move it to a different location.

The filename format I'm trying to select from has six _-separatedseparated sections like the example below:

I_XXX_PACK_6788669_6_9358869.pdf 
I_XXX_PACK_6788669_6_9358869.pdf 

What I am trying to do is select only files that have a particular value inthe last section 6in the file name (e.g. 9358869) and ignore all others pdf files in the directory.

Can it be done with Unix tools (POSIX find, sed, grep, etc.), my main issue right now is trying to only get only the one file that was 6 separated sections in its filename and ignoring all other files.

  • Can this be done with bash only?
  • Also is it possible to only choose the files that were created 1hr prior to system time? I have use sed on other file types to check for time, but not on a pdf file. So I am not sure if that is possible or not

I am needing some help with a script. I'm currently trying to select PDF files that meet a specific requirement in the file name.

The filename format I'm trying to select has six _-separated sections like the example below:

I_XXX_PACK_6788669_6_9358869.pdf 

What I am trying to do is select only files that have a particular value in section 6 (e.g. 9358869) and ignore all others.

  • Can this be done with bash only?
  • Also is it possible to only choose the files that were created 1hr prior to system time?

I am needing some help with a script. I'm currently trying to select PDF file that meets a specific requirement in the file name in order to move it to a different location.

The filename format I'm trying to select from has separated sections like the example below:

I_XXX_PACK_6788669_6_9358869.pdf 

What I am trying to do is select only files that have the last section in the file name (e.g. 9358869) and ignore all others pdf files in the directory.

Can it be done with Unix tools (POSIX find, sed, grep, etc.), my main issue right now is trying to only get only the one file that was 6 separated sections in its filename and ignoring all other files.

  • Also is it possible to only choose the files that were created 1hr prior to system time? I have use sed on other file types to check for time, but not on a pdf file. So I am not sure if that is possible or not
added 2 characters in body
Source Link
aviro
  • 7k
  • 17
  • 36

I am needing some help with a script. I'm currently trying to select PDF files that meet a specific requirement in the file name.

The filename format I'm trying to select has six _-separated sections like the example below:

I_XXX_PACK_6788669_6_9358869.pdf 

What I am trying to do is select only files that have a particular value in section 6 (e.g. 9358869) and igonreignore all others.

  • Can this be done with backbash only?
  • Also is it possible to only choose the files that were created 1hr prior to system time?

I am needing some help with a script. I'm currently trying to select PDF files that meet a specific requirement in the file name.

The filename format I'm trying to select has six _-separated sections like the example below:

I_XXX_PACK_6788669_6_9358869.pdf 

What I am trying to do is select only files that have a particular value in section 6 (e.g. 9358869) and igonre all others.

  • Can this be done with back only?
  • Also is it possible to only choose the files that were created 1hr prior to system time?

I am needing some help with a script. I'm currently trying to select PDF files that meet a specific requirement in the file name.

The filename format I'm trying to select has six _-separated sections like the example below:

I_XXX_PACK_6788669_6_9358869.pdf 

What I am trying to do is select only files that have a particular value in section 6 (e.g. 9358869) and ignore all others.

  • Can this be done with bash only?
  • Also is it possible to only choose the files that were created 1hr prior to system time?
Improve formatting, streamline question body, re-tag
Source Link
AdminBee
  • 23.6k
  • 25
  • 55
  • 77
Loading
Source Link
Loading