List files outside CLI
Hello again, this feels like a stupid question, but is there any way to list the files of the DFC *outside* the dirac-dms-filecatalog-cli? That is, I want a list of files and folders inside a known directory, without any interactive stuff going on. I cannot seem to find the right command for that. Cheers Lukas -- Lukas KOCH Particle Physics Department STFC Rutherford Appleton Laboratory Mail: lukas.koch@stfc.ac.uk Tel: +44 (0) 1235 44 x6265
Hi Lucas, is this what you are looking for ? dirac-dms-find-lfns Path=/t2k.org/user (it's recursive though). regards, Daniela On Tue, 13 Nov 2018 at 16:57, Lukas Koch <lukas.koch@stfc.ac.uk> wrote:
Hello again,
this feels like a stupid question, but is there any way to list the files of the DFC *outside* the dirac-dms-filecatalog-cli? That is, I want a list of files and folders inside a known directory, without any interactive stuff going on. I cannot seem to find the right command for that.
Cheers Lukas
-- Lukas KOCH Particle Physics Department STFC Rutherford Appleton Laboratory Mail: lukas.koch@stfc.ac.uk Tel: +44 (0) 1235 44 x6265
-- _______________________________________________ Gridpp-Dirac-Users mailing list Gridpp-Dirac-Users@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/gridpp-dirac-users
-- Sent from the pit of despair ----------------------------------------------------------- daniela.bauer@imperial.ac.uk HEP Group/Physics Dep Imperial College London, SW7 2BW Tel: +44-(0)20-75947810 http://www.hep.ph.ic.ac.uk/~dbauer/
Hi Daniela, almost. A non-recursive version would be handy. Right now I am improvising one like this: $ echo "ls /t2k.org/some/path/" | dirac-dms-filecatalog-cli with some output clean up afterwards. It's not pretty, but it works. For now. Cheers Lukas Am 13/11/2018 um 17:14 schrieb Daniela Bauer:
Hi Lucas,
is this what you are looking for ? dirac-dms-find-lfns Path=/t2k.org/user (it's recursive though).
regards, Daniela On Tue, 13 Nov 2018 at 16:57, Lukas Koch <lukas.koch@stfc.ac.uk> wrote:
Hello again,
this feels like a stupid question, but is there any way to list the files of the DFC *outside* the dirac-dms-filecatalog-cli? That is, I want a list of files and folders inside a known directory, without any interactive stuff going on. I cannot seem to find the right command for that.
Cheers Lukas
-- Lukas KOCH Particle Physics Department STFC Rutherford Appleton Laboratory Mail: lukas.koch@stfc.ac.uk Tel: +44 (0) 1235 44 x6265
-- _______________________________________________ Gridpp-Dirac-Users mailing list Gridpp-Dirac-Users@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/gridpp-dirac-users
-- Lukas KOCH Particle Physics Department STFC Rutherford Appleton Laboratory Mail: lukas.koch@stfc.ac.uk Tel: +44 (0) 1235 44 x6265
Hi Lucas, What's the use case for this? Unfortunately there isn't really a plain ls tool in DIRAC at the moment. Regards, Simon On Tue, Nov 13, 2018 at 05:56:16PM +0000, Lukas Koch wrote:
Hi Daniela,
almost. A non-recursive version would be handy. Right now I am improvising one like this:
$ echo "ls /t2k.org/some/path/" | dirac-dms-filecatalog-cli
with some output clean up afterwards. It's not pretty, but it works. For now.
Cheers Lukas
Am 13/11/2018 um 17:14 schrieb Daniela Bauer:
Hi Lucas,
is this what you are looking for ? dirac-dms-find-lfns Path=/t2k.org/user (it's recursive though).
regards, Daniela On Tue, 13 Nov 2018 at 16:57, Lukas Koch <lukas.koch@stfc.ac.uk> wrote:
Hello again,
this feels like a stupid question, but is there any way to list the files of the DFC *outside* the dirac-dms-filecatalog-cli? That is, I want a list of files and folders inside a known directory, without any interactive stuff going on. I cannot seem to find the right command for that.
Cheers Lukas
-- Lukas KOCH Particle Physics Department STFC Rutherford Appleton Laboratory Mail: lukas.koch@stfc.ac.uk Tel: +44 (0) 1235 44 x6265
-- _______________________________________________ Gridpp-Dirac-Users mailing list Gridpp-Dirac-Users@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/gridpp-dirac-users
Hi Simon, in this case, the use case is simply mapping the old gfal-commands to new dirac-commands for a quick and dirty implementation of DIRAC in the T2K Data Manager. But I am sure that it would be useful to have this kind of command for all kinds of automated scripts involving file transfers and DIRAC. Cheers Lukas Am 14/11/2018 um 09:58 schrieb Simon Fayer:
Hi Lucas,
What's the use case for this? Unfortunately there isn't really a plain ls tool in DIRAC at the moment.
Regards, Simon
On Tue, Nov 13, 2018 at 05:56:16PM +0000, Lukas Koch wrote:
Hi Daniela,
almost. A non-recursive version would be handy. Right now I am improvising one like this:
$ echo "ls /t2k.org/some/path/" | dirac-dms-filecatalog-cli
with some output clean up afterwards. It's not pretty, but it works. For now.
Cheers Lukas
Am 13/11/2018 um 17:14 schrieb Daniela Bauer:
Hi Lucas,
is this what you are looking for ? dirac-dms-find-lfns Path=/t2k.org/user (it's recursive though).
regards, Daniela On Tue, 13 Nov 2018 at 16:57, Lukas Koch <lukas.koch@stfc.ac.uk> wrote:
Hello again,
this feels like a stupid question, but is there any way to list the files of the DFC *outside* the dirac-dms-filecatalog-cli? That is, I want a list of files and folders inside a known directory, without any interactive stuff going on. I cannot seem to find the right command for that.
Cheers Lukas
-- Lukas KOCH Particle Physics Department STFC Rutherford Appleton Laboratory Mail: lukas.koch@stfc.ac.uk Tel: +44 (0) 1235 44 x6265
-- _______________________________________________ Gridpp-Dirac-Users mailing list Gridpp-Dirac-Users@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/gridpp-dirac-users
-- Lukas KOCH Particle Physics Department STFC Rutherford Appleton Laboratory Mail: lukas.koch@stfc.ac.uk Tel: +44 (0) 1235 44 x6265
Hi Lukas, If it helps, I've attached a short script below demonstrating how to get a basic listing using the python API... Regards, Simon #!/usr/bin/env python import sys from DIRAC.Core.Base import Script Script.initialize() from DIRAC.Resources.Catalog.FileCatalog import FileCatalog def list_dir(fc, path): res = fc.listDirectory(path) if not res['OK']: print >>sys.stderr, "Failed to list path '%s': %s", path, res['Message'] return listing = res['Value']['Successful'][path] for item in sorted(listing['Files'].keys() + listing['SubDirs'].keys()): print item def main(): fc = FileCatalog() if len(sys.argv) < 2: print >>sys.stderr, "Usage: diracls.py <path> ..." sys.exit(1) for path in sys.argv[1:]: list_dir(fc, path) if __name__ == '__main__': main()
participants (3)
-
Daniela Bauer
-
Lukas Koch
-
Simon Fayer