[Python] Deleting files on remote server via python script indicated as hidden

Discussão em 'Python' iniciado por Stack, Novembro 20, 2024.

  1. Stack

    Stack Membro Participativo

    I have a python script that initiates deletion of files in a folder on a remote sftp server. The deletion is indicated in the log. Upon check on the remote directory and when I list with 'ls' I get empty line and no files present:

    sftp> cd PATH/
    sftp> ls
    sftp>


    However when I list with ls -al:

    sftp> ls -al
    drwxrwxr-x 2 6055 6052 4096 Nov 20 05:23 .
    drwxrwxr-x 4 6055 6052 4096 Oct 24 11:07 ..
    -rw-r--r-- 1 6055 6052 6742 Nov 15 20:10 .file1.csv
    -rw-r--r-- 1 6055 6052 6742 Nov 18 19:23 .file2.csv
    -rw-r--r-- 1 6055 6052 6743 Nov 19 19:21 .file3.csv
    -rw-r--r-- 1 6055 6052 7179 Nov 15 18:52 .file4.csv
    -rw-r--r-- 1 6055 6052 7178 Nov 18 18:03 .file5.csv
    -rw-r--r-- 1 6055 6052 7182 Nov 19 18:03 .file6.csv


    The files listed using ls -al all begin with a . (dot), indicating that they are hidden files. The default ls command in SFTP does not show hidden files. Does it mean that I need to modify the script to include Hidden Files in deletion process ? Or they are indeed deleted /masked as deleted and won't be copied/transferred from other scripts ?

    Continue reading...

Compartilhe esta Página