Jump to content


Getting fstat to return only files that have not been deleted

fstat cli

  • Please log in to reply
2 replies to this topic

#1 fny850

fny850

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 14 June 2016 - 08:57 PM

Hi! Relatively new Perforce user here, running the P4 Linux CLI 2012.1/459601 with server version 2015.2/1264740. I had a question about running fstat against a wildcard path, such as this:

//Stuff/....txt

The goal of which being to produce a list of fstat data that contains all files in the "Stuff" depot that ends with ".txt". This works great, except for one problem: It returns everything, including files that have already been deleted. Is there a filter that I can pass with the fstat command so that it suppresses deleted files?

#2 fny850

fny850

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 16 June 2016 - 02:55 PM

One way I found to do this, which may not be the best way, is to use a filesize filter. Since deleted files will have a file size of 0, and at the moment we don't need to return information on files with no contents, this seems to work:

fstat -Ol -F "fileSize > 0" //Stuff/....txt

But is there a better way?

#3 P4Sam

P4Sam

    Advanced Member

  • Members
  • PipPipPip
  • 484 posts
  • LocationSan Francisco, CA

Posted 16 June 2016 - 10:05 PM

Do you need all of the data that fstat returns, or just a list of files?  If you just need the list of files, try this:

p4 files -e //Stuff/....txt

If you want to turn that into an fstat query you can do (this might need a newer CLI since the fancy scripting flags are fairly recent):

p4 -F %depotFile% files -e //Stuff/....txt | p4 -x - fstat






Also tagged with one or more of these keywords: fstat, cli

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users