Solved

Python - List file

  • 11 August 2023
  • 1 reply
  • 36 views

Badge

Hello,

 

I need your help to understand how to do a browse through files with python.

 

The ArchiveSet=MyArchiveSet1A have 14day retention period.
We want to preserve diferent versions of the same file. When we run backup on a file the previous version is replaced by the new one...

When browsing the Backupset = MyArchiveSet1A we only get the last versions of the files.

How to preserve multiple versions of the same file in the Archiveset ?

 We are using Commvault 11.30

 

###
# _f2bk - full path of the file to backup
# _d2bk - path to browse

ctx = Commcell('spfpt01cmv01','USER','PASSWD')
client = ctx.clients.get(_client)
agent = client.agents.get('File System')

yn = agent.backupsets.has_backupset('MyArchiveSet1A')
if yn:
  print("### Exist ###")
  backupset = agent.backupsets.get('MyArchiveSet1A')

subclient = backupset.subclients.get('default')

subclient.content = [_f2bk]
subclient.enable_backup()

job_backup = subclient.backup(backup_level='Full')

stt=job_backup.status
while stt == 'Running':
  print("Backup status: "+stt)
  stt=job_backup.status
  time.sleep(10)
print ("Done")

###
### BROWSE
###
P, D = subclient.browse(path=_d2bk, show_deleted=True,from_date='2023-04-01')
print("## Paths")
print(P)
print("## Details")
print(D)
###
ctx.logout()
###

icon

Best answer by Navneet Singh 14 August 2023, 10:21

View original

1 reply

Userlevel 3
Badge +10

@Pedro Lages 

Please check the below DOC and let us know if this helps for your python queries.

https://github.com/Commvault/cvpysdk

https://documentation.commvault.com/2022e/essential/45532_samples_for_developer_sdk_for_python.html

Reply