実際にsftpサーバーから「ctime」(ファイル作成時のタイムスタンプ)を取得する方法があるかご存知ですか? SFTP に paramiko を使用すると、「atime」と「mtime」しか表示されません。ただし、ファイルの元の作成タイムスタンプ(「atime」ではない)にアクセスしようとしています。
これは私が構築した現在のコードですが、エラーが発生する可能性があるため、ファイル作成タイムスタンプに関する部分をコメントアウトしました。
for file in tqdm(sftp.listdir()): # Debug check: print('We are now in the try loop:') # Look for files that have the same starting 25 characters as the column # in the mapper file: mask = mapper.file_name_startswith.str[:25].str.contains(file[:25]) # Grab the destination path info from the mapper file: dest_path = mapper[mask]['destination_path'].values[0] # Get the timestamp of the original file before we remove it, for both modified & created: remote_mod_time = sftp.stat(file).st_mtime # Need to use a different method to get the created date: ''' remote_file_attrs = sftp.listdir_attr('.') for attr in remote_file_attrs: if attr.filename == file: remote_create_time = attr.st_ctime break ''' # Move the current file to our desired local (destination) path: local_path = os.path.join(dest_path, file) sftp.get(file, local_path) # Set the modified date timestamp of the downloaded file to match the timestamp of the original file: os.utime(local_path, (remote_mod_time, remote_mod_time)) # Set the created date (cannot use os.utime for this) to match the timestamp of the original file: #date_time = pywintypes.Time(remote_create_time) #win32file.SetFileTime(local_path, date_time, None, None) # Remove the current file, which is being processed, from the sftp server: #sftp.remove(file) # Append the file to the "done_file" list: done_files.append(file)
正解
ファイル作成時間は、SFTP バージョン 4 以降でのみサポートされます。ほとんどの SFTP サーバー (特に OpenSSH) は、SFTP バージョン 3 のみをサポートします。 Paramiko (クライアント側) にも同じことが当てはまります。
したがって、ほとんどの場合 (SFTP 4 をサポートするために Paramiko にパッチを当てたとしても) SFTP サーバーから作成時刻を取得することはできません。
サーバーへのシェル アクセス権がある場合は、シェル コマンドを使用して作成時刻を取得できる場合があります。しかし、これはもはや SFTP の問題ではありません。
以上がParamiko SFTP を使用してファイルの作成タイムスタンプを取得するの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

slicingapythonlistisdoneusingtheyntaxlist [start:stop:step] .hore'showitworks:1)startisthe indexofthefirstelementtoinclude.2)spotisthe indexofthefirmenttoeexclude.3)staptistheincrementbetbetinelements

numpyallows forvariousoperationsonarrays:1)basicarithmeticlikeaddition、減算、乗算、および分割; 2)AdvancedperationssuchasmatrixMultiplication;

Arraysinpython、特にnumpyandpandas、aresentialfordataanalysis、offeringspeedandeficiency.1)numpyarraysenable numpyarraysenable handling forlaredatasents andcomplexoperationslikemoverages.2)Pandasextendsnumpy'scapabivitieswithdataframesfortruc

listsandnumpyarraysinpythonhavedifferentmemoryfootprints:listsaremoreflexiblellessmemory-efficient、whileenumpyarraysaraysareoptimizedfornumericaldata.1)listsstorereferencesto objects、with whowedaround64byteson64-bitedatigu

toensurepythonscriptsbehaveCorrectlyAcrossDevelosment、staging、and Production、usetheseStrategies:1)環境variablesforsimplestetings、2)configurationfilesforcomplexsetups、and3)dynamicloadingforadaptability.eachtododododododofersuniquebentandrequiresca

Pythonリストスライスの基本的な構文はリストです[start:stop:step]。 1.STARTは最初の要素インデックス、2。ストップは除外された最初の要素インデックスであり、3.ステップは要素間のステップサイズを決定します。スライスは、データを抽出するためだけでなく、リストを変更および反転させるためにも使用されます。

ListSoutPerformArraysIn:1)ダイナミシジョンアンドフレーケンティオン/削除、2)ストーリングヘテロゼンダタ、および3)メモリ効率の装飾、ButmayhaveslightPerformancostsinceNASOPERATIONS。

toconvertapythonarraytoalist、usetheList()constructororageneratorexpression.1)importhearraymoduleandcreateanarray.2)useList(arr)または[xforxinarr] toconvertoalistは、largedatatessを変えることを伴うものです。


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

SecLists
SecLists は、セキュリティ テスターの究極の相棒です。これは、セキュリティ評価中に頻繁に使用されるさまざまな種類のリストを 1 か所にまとめたものです。 SecLists は、セキュリティ テスターが必要とする可能性のあるすべてのリストを便利に提供することで、セキュリティ テストをより効率的かつ生産的にするのに役立ちます。リストの種類には、ユーザー名、パスワード、URL、ファジング ペイロード、機密データ パターン、Web シェルなどが含まれます。テスターはこのリポジトリを新しいテスト マシンにプルするだけで、必要なあらゆる種類のリストにアクセスできるようになります。

メモ帳++7.3.1
使いやすく無料のコードエディター

DVWA
Damn Vulnerable Web App (DVWA) は、非常に脆弱な PHP/MySQL Web アプリケーションです。その主な目的は、セキュリティ専門家が法的環境でスキルとツールをテストするのに役立ち、Web 開発者が Web アプリケーションを保護するプロセスをより深く理解できるようにし、教師/生徒が教室環境で Web アプリケーションを教え/学習できるようにすることです。安全。 DVWA の目標は、シンプルでわかりやすいインターフェイスを通じて、さまざまな難易度で最も一般的な Web 脆弱性のいくつかを実践することです。このソフトウェアは、

ドリームウィーバー CS6
ビジュアル Web 開発ツール

MinGW - Minimalist GNU for Windows
このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

ホットトピック









