最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Deleting files on remote server via python script indicated as hidden - Stack Overflow

programmeradmin0浏览0评论

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 the deletion process? Or are they indeed deleted /masked as deleted and won't be copied/transferred from other scripts?

发布评论

评论列表(0)

  1. 暂无评论